sayndesyn Posted January 18, 2007 Share Posted January 18, 2007 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 qualitySo 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]<?phpHeader("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 Quote Link to comment https://forums.phpfreaks.com/topic/34663-gd-jpeg-snafu/ Share on other sites More sharing options...
sayndesyn Posted January 18, 2007 Author Share Posted January 18, 2007 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/34663-gd-jpeg-snafu/#findComment-163831 Share on other sites More sharing options...
redbullmarky Posted January 18, 2007 Share Posted January 18, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/34663-gd-jpeg-snafu/#findComment-163842 Share on other sites More sharing options...
sayndesyn Posted January 19, 2007 Author Share Posted January 19, 2007 Gracias! That worked, and the thumbnails are loading. Now I have to try and sort out the next error in this quagmire. Did I mention I'm a graphic designer, and suck at php... Quote Link to comment https://forums.phpfreaks.com/topic/34663-gd-jpeg-snafu/#findComment-164153 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.