Jump to content


image resize script was working - not working anymore!

  • Please log in to reply
2 replies to this topic

#1 mcpalmer

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 March 2006 - 07:19 PM


I'm using a simple image resize php script to resize images. It was working fine but has now stopped working but can't figure out why! The script is:

$src = imagecreatefromjpeg($image);
    $width = imagesx($src);
    $height = imagesy($src);
    $x = $w; $y = $h;
    $dst = imagecreatetruecolor($x,$y);
    header('Content-Type: image/png');

Its saved as scale_img.php and called from another page like so:

<img src="scale_img.php?image=images/horses.jpg&w=100&h=100" />

Is there anything wrong with the php code? It looks ok to me. Could changed php settings on the server ( i use third party) affect it working or not? Other php/mysql scripts work fine

#2 kenrbnsn

  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 March 2006 - 08:16 PM

What do mean by "not working"?

Looking at your code, it looks like you're assuming that register_globals is enabled. If your host set it to disabled, that would explain the problem.

If this is the problem -- comfirm it with your host, then the fix is simple, just change "$image" to $_GET['image']
$src = imagecreatefromjpeg($_GET['image']);

If you host changed register_globals from enabled to disabled without telling you, then if I were you, I would complain loudly.


#3 mcpalmer

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 March 2006 - 11:34 PM

I tried other gd functions and they didn't work either so it appears the host has messed up big time! It appears a security update screwed things up - great! The webspace is really cheap but i didn't expect this to happen!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users