Dumps Posted February 7, 2007 Share Posted February 7, 2007 I have a straightforward script that allows users to query a database and return a list of matching companies complete with company logo. I'm using ShowImage.php <?php header('Content-Type: image/jpeg'); $name = $_REQUEST["name"]; $name = "Logos/" . $name; $image=imagecreatefromjpeg($name); imagejpeg($image); ?> to return the image. The results of the query are displayed using the Display_Estate_Agents function; <?php function Display_Estate_Agents($result) { //fetch into $row array while ($row = @ mysql_fetch_row($result)) { $name = "{$row[12]}"; //print "logo: $name"; print "<table width=\"542\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\"> <tr align=\"left\" valign=\"top\"> <td width=\"243\" class=\"PIBodyBoldRed\">{$row[0]} </td> <td width=\"295\"> </td> </tr> <tr align=\"left\" valign=\"top\" class=\"PIBody\"> <td>{$row[1]}</td> <td><span class=\"PIBodyBoldRed\">Tel: </span>{$row[8]} </td> </tr> <tr align=\"left\" valign=\"top\" class=\"PIBody\"> <td>{$row[2]}</td> <td><span class=\"PIBodyBoldRed\">Fax: </span>{$row[9]}</td> </tr> <tr align=\"left\" valign=\"top\" class=\"PIBody\"> <td>{$row[3]}</td> <td class=\"PIBodyBoldRed\">Email:{$row[10]}</td> </tr> <tr align=\"left\" valign=\"top\" class=\"PIBody\"> <td>{$row[4]}</td> <td> <span class=\"PIBodyBoldRed\">Web: </span>{$row[11]} </td> </tr> <tr align=\"left\" valign=\"top\" class=\"PIBody\"> <td>{$row[6]}</td> <td> </td> </tr> <tr align=\"left\" valign=\"top\" class=\"PIBody\"> <td>{$row[7]}</td> <td> </td> </tr> <tr align=\"left\" valign=\"middle\">"; print "<td width=\"200\" height=\"90\"><img src=\"showimage.php?name=$name\"></td>"; print "<td>{$row[13]}</td> </tr></table>"; } ?> When the files are uploaded to my own server the images display correctly and there is no problem. However, when I upload the relevant files to the server where the site is hosted the images do not display. I have checked that the logo name exists in the logos folder. I guess there must be some difference between the servers to explain why identical files work differently, but as a newbie I'm not really sure. Can anyone help me and explain why this doesn't work? As far as I know both servers are running the same version of PHP. Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/ Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 Does your remote server have the gd library installed as part of the PHP configuration? Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179097 Share on other sites More sharing options...
Dumps Posted February 7, 2007 Author Share Posted February 7, 2007 Good question. How do I find out? Would it be listed if I use PHPinfo? Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179102 Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 Yes it would. Under your configuration bit it should be listed as --with-gd, and gd will also have a section of its own later down to see what capabilities it has. Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179103 Share on other sites More sharing options...
Dumps Posted February 7, 2007 Author Share Posted February 7, 2007 I think its installed as its in the configuration bit and has its own section saying its enabled Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179106 Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 Does it have JPEG support enabled? That should appear under the gd section, as well as with the line --with-jpeg-dir=some_dir Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179107 Share on other sites More sharing options...
Dumps Posted February 7, 2007 Author Share Posted February 7, 2007 Yep, jpeg support is enabled and in the configure command section Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179109 Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 Try using $_GET instead of $_REQUEST. Also, find out the different versions of PHP being used. If their version of PHP is 4.1.0 or lower, then you don't have access to $_REQUEST. Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179112 Share on other sites More sharing options...
Dumps Posted February 7, 2007 Author Share Posted February 7, 2007 Ok, I'll try that and check out the versions. Cheers Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179114 Share on other sites More sharing options...
Dumps Posted February 8, 2007 Author Share Posted February 8, 2007 Fixed it. The problem was that one server was Windows and the other Linux and I had not been consistent with my file name in the script. So once showimage.php became ShowImage.php, and inside the script Logos had become logos everything worked just fine. From now on all will be lowercase.....! Link to comment https://forums.phpfreaks.com/topic/37459-solved-problem-with-images/#findComment-179757 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.