Jump to content

Recommended Posts

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";
        }

Link to comment
https://forums.phpfreaks.com/topic/154347-solved-getimagesize-question/
Share on other sites

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;
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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