xcandiottix Posted April 5, 2010 Share Posted April 5, 2010 I have a code that loads a picture up for display. The picture size is first checked and if it is too big it is resized via html height and width. Here's the display image code: echo '<center><img src="http://www.msormr.com/upload/'.$showpic.'" height="'.$newHeight.'" width="'.$newWidth.'"></center>'; In google chrome it works fine. I was going on with design when I friend noted that he couldn't see any of my images. I opened IE and found this to be true. At first I realized I had my height and width tags in reverse order but fixing that hasn't helped. Any suggestions?? Thanks, K.candiotti Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/ Share on other sites More sharing options...
Pikachu2000 Posted April 5, 2010 Share Posted April 5, 2010 Well, it looks fine. Have you looked at the HTML source to see if there is anything that Internet Exploder might not like? Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/#findComment-1037010 Share on other sites More sharing options...
xcandiottix Posted April 5, 2010 Author Share Posted April 5, 2010 I don't think so... my second image is 45gf4g545.jpeg I just checked in firefox and things look good there too. Maybe my IE is out of date, I'll check that next. It seems to be my resizing code. Some of the images are showing up as the correct height but only 1 pixel wide. Again, in firefox and chrome all is well. Here's my resizing code: //constrain size main img $whichimage = /upload/".$showpic.""; $wistring = str_replace(" ", "%20", $whichimage); $whichimage = $wistring; list($width, $height)= getimagesize($whichimage); if ($height > 600){ $ratio = 600 / $height; $newHeight = $height * $ratio; $width = $width * $ratio; } if ($width > 800){ $ratio = 800 / $width; $newWidth = $width * $ratio; $newHeight = $newHeight * $ratio; } Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/#findComment-1037011 Share on other sites More sharing options...
Pikachu2000 Posted April 5, 2010 Share Posted April 5, 2010 I just uploaded a pic to your website, and in Safari it displayed just fine, but here is the source HTML. Note that the <img> tag is not closed before the <br />. That is probably what is cratering IE. <td align="center" valign="top"> <img src = "http://www.msormr.com/upload/Condi_rice.jpg"<br /><br /> <span class="Blue">Here's your uploaded image but you're not done yet. Make sure to check your e-mail for the confirmation link so this image can be rated.</span></td> Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/#findComment-1037014 Share on other sites More sharing options...
xcandiottix Posted April 5, 2010 Author Share Posted April 5, 2010 Well i'm an idiot too. Check this out: //constrain size main img $whichimage = "http://www.msormr.com/upload/".$showpic.""; $wistring = str_replace(" ", "%20", $whichimage); $whichimage = $wistring; list($width, $height)= getimagesize($whichimage); if ($height > 600){ $Hratio = 600 / $height; $newHeight = $height * $Hratio; $width = $width * $Hratio; } else { $newHeight = $height; } if ($width > 800){ $Wratio = 800 / $width; $newWidth = $width * $Wratio; $newHeight = $newHeight * $Wratio; } else { $newWidth = $width; } Otherwise, if the picture is with in constraints it never gets set to $new height or width. Therefore when it's asked for in echo '<center><img src="/upload/'.$showpic.'" height="'.$newHeight.'" width="'.$newWidth.'"></center>'; it doesn't have a size. I think this fixed it! Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/#findComment-1037015 Share on other sites More sharing options...
xcandiottix Posted April 5, 2010 Author Share Posted April 5, 2010 I just uploaded a pic to your website, and in Safari it displayed just fine, but here is the source HTML. Note that the <img> tag is not closed before the <br />. That is probably what is cratering IE. <td align="center" valign="top"> <img src = "http://www.msormr.com/upload/Condi_rice.jpg"<br /><br /> <span class="Blue">Here's your uploaded image but you're not done yet. Make sure to check your e-mail for the confirmation link so this image can be rated.</span></td> Ahhh you're right there too! That's a separate page that doesn't run resizing but good catch none the less! =) Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/#findComment-1037016 Share on other sites More sharing options...
Pikachu2000 Posted April 5, 2010 Share Posted April 5, 2010 Excellent. Sometimes all it takes is a fresh look at things to figure them out. Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/#findComment-1037018 Share on other sites More sharing options...
xcandiottix Posted April 5, 2010 Author Share Posted April 5, 2010 indeed =p Thanks for the assistance! Link to comment https://forums.phpfreaks.com/topic/197596-problem-displaying-pictures/#findComment-1037019 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.