Jump to content

Recommended Posts

Hi,
  I was the designer for a site that needed to move to a new server, and the move went smoothly except that all of the gd-jpeg code is no longer outputting anything.  It confuses me because everything worked fine on the last server which was linux running php and mysql as well.  The new server is running php5 which is supposed to have 2.0.28 of gd-jpeg running, but if I view the source of the php page I see the following.
<b>Warning</b>:  imagecopyresampled(): supplied argument is not a valid Image resource in <b>/home/10434/domains/viewsfromabove.com/html/vfaPublishing/gallery/Augusta/thumb.php</b> on line <b>19</b><br />
ÿØÿà CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

So is gd-jpeg V1.0 actually running on the server and causing code incompatibilities?  The host is mediatemple.net who has always been on top of updates from my experience.  The code that the error is referencing is the following.  Like I said, it was working fine on the last server, but the host has dropped off the map and isn't answering phone calls, email, etc.

[code]
<?php
Header("Content-type: image/jpeg");
$orig_image = imagecreatefromjpeg($im);
list($ow, $oh) = getimagesize($im);
$big = imagecreatefromjpeg($im);
$thumb = imagecreatetruecolor(160,160);
if ($ow > $oh) {
  $off_w = ($ow-$oh)/2;
  $off_h = 0;
  $ow = $oh;
} elseif ($oh > $ow) {
  $off_w = 0;
  $off_h = ($oh-$ow)/2;
  $oh = $ow;
} else {
  $off_w = 0;
  $off_h = 0;
}
imagecopyresampled($thumb, $big, 0, 0, $off_w, $off_h, 160, 160, $ow, $oh);
imagejpeg($thumb);
imagedestroy($thumb);
imagedestroy($big);
?>


[/code]

Any help would be appreciated, Thanks, Sam
Link to comment
https://forums.phpfreaks.com/topic/34663-gd-jpeg-snafu/
Share on other sites

it would seem that GD is installed ok, else you wouldnt get the "supplied argument is not a valid Image resource in..." message.
where is $im set?:

[code]
$orig_image = imagecreatefromjpeg($im);
[/code]

if this is your full code, then i'm going to make an assumption - that it was written and ran on a server with register_globals turned ON. Most installations now have this off by default. Having it turned on (a bad thing as far as security goes) would let you reference $_GET['im'] (to get filename from the URL) as simply $im.

if this is the case, at the top of your code, try adding this:

[code]
<?php
$im = $_GET['im'];

... rest of code here
?>
[/code]

and see how that works.

cheers
Link to comment
https://forums.phpfreaks.com/topic/34663-gd-jpeg-snafu/#findComment-163842
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.