Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with getimagesize() in IE

Status
Not open for further replies.

dreammaker888

Programmer
Jul 31, 2007
44
US
I use getimagesize() to get the width and height of the image, then resize it so it display properly.

The code was working fine for two years in my website. All of a sudden, in IE, the image is only 1x1, so no one can see the picture. However, I was told, the picture displays properly in Firefox.

What changed and how can I rectify the problem so the picture will display properly.

Here's the code:

Code:
		$ImageSize = getimagesize($tURL);
        $pW= $ImageSize[0];
        $pH= $ImageSize[1];
		
		if ($pW >= 100)
			{
			$pH = 100/$pW * $pH; 
			$pW = 100;
			}			
		if ($pH >= 100)
			{
			$pW = 100/$pH * $pW;
			$pH = 100;
			}
 
is that code really doing what you intended?
other than curious logic (which may be intended) there is nothing wrong. and obviously php does not interact directly with the browser so any anomaly will be browser specific or related to a basic flaw in your display code which the browsers are accommodating differently.
 
Yes, it is browser specific. But the part I don't understand was, it has been working for 2 years and all of sudden it doesn't anymore.

What changed?

So, I wrote the work around this morning. I uploaded the width and height of the pictures in mySQL. Modified the code to pick up the dimension from the database statically, instead of using getimagesize().

That works.

I was hoping for someone who can point out the problem so I can add this to my knowledge.
 
it probably won't have worked properly at all but your normal browser has been interpreting the flawed code in a particular way. your browser may have updated itself overnight and started doing things a different way.
 
I don't know why you said the code was flawed.
Help me understand please.

I have pined down the part that doesn't work properly was the getimagesize() function. When we replaced it with code to read the data from mySQL, the rest of the code works properly.
 
your display code. i think the logic in your php code is a bit odd but i am more concerned with your display code: i.e. the html that is pumped out to the browser.

point us to a page where you are having the problem.
 
The display code works fine when we did away with getimagesize().

Here's the code for display:
Code:
echo '<td width="16%" align="center"><A href="javascript: popItem(\'' . 'OpenItm.php?$c=' .$iCode . '\')" onmouseover="Tip(\'' . $adDesc . '\')" onmouseout="UnTip()"><img border="1" src="' . $tURL . '" width="' . $pW . '" height="' .$pH . '"></a></td>';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top