Jump to content

[SOLVED] Problem with images


Dumps

Recommended Posts

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

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.....!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.