acctman Posted April 16, 2009 Share Posted April 16, 2009 hi i'm trying to use getimagesize() with a php image retrieval link that I created but for obivious reason it does not work. As you can see from the error below the pvtexp.php is the php image processing file so its not able to get the image size since php file is serving the image. is there any way around this? I need the image size for resizing the image on the page. error: Warning: getimagesize(/files/pvtexp.php?mid=39&iid=56390&idat=2005/02&sec=3) [function.getimagesize]: failed to open stream: No such file or directory code i'm trying to use... $result = getimagesize($en['profile_image_loc']); $en['imgpadding'] = ""; if($result) { if($result[0] >= $result[1]) { if(($result[1] * (220 / $result[0])) <= 144) { $en['imgsize'] = " width=220"; $en['imgpadding'] = " style=\"padding-top: " . round((144 - ($result[1] * (220 / $result[0]))) / 2) . "px;\""; } else { $en['imgsize'] = " height=144"; } Quote Link to comment https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/ Share on other sites More sharing options...
ober Posted April 16, 2009 Share Posted April 16, 2009 Pass it the image? There really is no other way. Quote Link to comment https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/#findComment-811437 Share on other sites More sharing options...
acctman Posted April 16, 2009 Author Share Posted April 16, 2009 Pass it the image? There really is no other way. so i'd put the getimagesize in the pvtexp.php and then how would I pull the value on the main.php page? part of the pvtexp.php image display file. ... if ($_GET['sec'] == 2) { $type = "imgExp"; } if ($_GET['sec'] == 3) { $type = "imgPub"; } $im = @imagecreatefromjpeg('http://server2.com/'.$date.'/'.$mid.'/'.$type.'/'.($_GET['tmb']==1 ? 'imgTmb/' : '').$mid.'-'.$iid.'.jpg'); if(!$im) { exit(); } header("Content-type: image/jpeg"); imagejpeg($im); imagedestroy($im); } $buf = ob_get_contents(); ob_end_clean(); print $buf; ?> Quote Link to comment https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/#findComment-811448 Share on other sites More sharing options...
ober Posted April 16, 2009 Share Posted April 16, 2009 Do you not have access to the image directly? Quote Link to comment https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/#findComment-811450 Share on other sites More sharing options...
acctman Posted April 16, 2009 Author Share Posted April 16, 2009 Do you not have access to the image directly? yes, i have direct access to the images on the other server Quote Link to comment https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/#findComment-811452 Share on other sites More sharing options...
ober Posted April 16, 2009 Share Posted April 16, 2009 http://us.php.net/getimagesize Example #3 is what you are after. Quote Link to comment https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/#findComment-811453 Share on other sites More sharing options...
acctman Posted April 16, 2009 Author Share Posted April 16, 2009 http://us.php.net/getimagesize Example #3 is what you are after. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/#findComment-811456 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.