Jump to content

Recommended Posts

I have just discovered after hrs of trying to fix a problem where it's coming from. It's to do with the php function getimagesize() and path names.

 

When using these two different sets of code:

 

<?php
list($width, $height, $type, $attr) = getimagesize("store_closed.gif");
echo "<img src=\"store_closed.gif\" $attr alt=\"getimagesize() example\" />";
?>

 

 

<?php
list($width,$height,$type,$attr)=getimagesize("C:\inetpub\wwwroot\hifisquad.com\store_closed.gif");
echo $width;
echo $height;
echo $type;
echo $attr;
?>

 

However when I try and use this function with a path like this: http://www.myname.com/store_closed.gif

the page errors.

 

I'm running this system on a Win2008 IIS7 server, is there a setting to enable the above style of path or am I missing something else?  :shrug:

Link to comment
https://forums.phpfreaks.com/topic/180554-iis7-and-getimagesize-problem/
Share on other sites

Hi,

 

The problem with that is this code is part of a pre-built shopping cart system and it's error-ing when it's generating the customer email and the admin email. All the files that are being called are located on the sever so I don't know what to do.

the function can only get the image file size of local file you will have to fetch the file off the web write it to a local file and then run the function

 

Sure about that? ;)

 

daniel@daniel-laptop:~$ php -r "var_dump(getimagesize('http://www.phpfreaks.com/media/images/forums/bg_header.png'));"
array(6) {
  [0]=>
  int(950)
  [1]=>
  int(133)
  [2]=>
  int(3)
  [3]=>
  string(24) "width="950" height="133""
  ["bits"]=>
  int(
  ["mime"]=>
  string(9) "image/png"
}
daniel@daniel-laptop:~$

 

However when I try and use this function with a path like this: http://www.myname.com/store_closed.gif

the page errors.

 

Do you want us to guess the errors, or are you going to tell us? :)

Sorry I forgot that not everyone psychic ability is as good as mine ;)

 

This was the error from the second code I printed:

 

PHP Warning: getimagesize(http://www.hifisquad.com/store_closed.gif) [function.getimagesize]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\inetpub\wwwroot\hifisquad.com\getim.php on line 2

 

I think I may have found the fault, but will let you know....

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.