browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need PHP help?

Get answers from our community of PHP experts on BYTES! It's free.

getimagesize() function problem

rcb845@yahoo.fr
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi everybody of the PHP community,

I am using the php function "getimagesize()" to access the
width/height of an image
from the Web. This function should return false if image is not
available.

Most of the time the function works correctly, but in 2 or 3 cases I
have
a problem like, search is going on for minutes, and the function does
not return a
false return-code as it should if image is not available ?

If I enter the URL directly in the browser, the result is the same,
browser search for
Minutes and does not return any error.

Does anyone has experience with a similar problem, is there a timeout
that we can
Give to the function getimagesize() ?

Your comments are very welcome and best regards

Tks for your help
RCB845



DH
Guest
 
Posts: n/a
#2: Jul 17 '05

re: getimagesize() function problem


rcb845@yahoo.fr wrote:[color=blue]
> Hi everybody of the PHP community,
>
> I am using the php function "getimagesize()" to access the
> width/height of an image
> from the Web. This function should return false if image is not
> available.[/color]

Shouldn't you first check to make sure the image exists?

$source = './images/some.gif';

file_exists($source)
? list($width, $height, $type, $attrib) = getimagesize($source)
: die('Unable to locate a required script: '.$source);
Chung Leong
Guest
 
Posts: n/a
#3: Jul 17 '05

re: getimagesize() function problem


<rcb845@yahoo.fr> wrote in message
news:18b577b2.0502160417.2963050e@posting.google.c om...[color=blue]
> Hi everybody of the PHP community,
>
> I am using the php function "getimagesize()" to access the
> width/height of an image
> from the Web. This function should return false if image is not
> available.
>
> Most of the time the function works correctly, but in 2 or 3 cases I
> have
> a problem like, search is going on for minutes, and the function does
> not return a
> false return-code as it should if image is not available ?
>
> If I enter the URL directly in the browser, the result is the same,
> browser search for
> Minutes and does not return any error.
>
> Does anyone has experience with a similar problem, is there a timeout
> that we can
> Give to the function getimagesize() ?
>
> Your comments are very welcome and best regards
>
> Tks for your help
> RCB845[/color]

Trying ini_set('default_socket_timeout', ???).


rcb845@yahoo.fr
Guest
 
Posts: n/a
#4: Jul 17 '05

re: getimagesize() function problem


DH <doug861@comcast.net> wrote in message news:<R6ydnXTws--H7Y7fRVn-pA@comcast.com>...[color=blue]
> rcb845@yahoo.fr wrote:[color=green]
> > Hi everybody of the PHP community,
> >
> > I am using the php function "getimagesize()" to access the
> > width/height of an image
> > from the Web. This function should return false if image is not
> > available.[/color]
>
> Shouldn't you first check to make sure the image exists?
>
> $source = './images/some.gif';
>
> file_exists($source)
> ? list($width, $height, $type, $attrib) = getimagesize($source)
> : die('Unable to locate a required script: '.$source);[/color]



Tks for the info, but I think file_exists() cannot be used
with URL but only with regular files.
RCB845 Feb 18
rcb845@yahoo.fr
Guest
 
Posts: n/a
#5: Jul 17 '05

re: getimagesize() function problem


"Chung Leong" <chernyshevsky@hotmail.com> wrote in message news:<X9mdncMz_uZUfo7fRVn-qA@comcast.com>...[color=blue]
> <rcb845@yahoo.fr> wrote in message
> news:18b577b2.0502160417.2963050e@posting.google.c om...[color=green]
> > Hi everybody of the PHP community,
> >
> > I am using the php function "getimagesize()" to access the
> > width/height of an image
> > from the Web. This function should return false if image is not
> > available.
> >
> > Most of the time the function works correctly, but in 2 or 3 cases I
> > have
> > a problem like, search is going on for minutes, and the function does
> > not return a
> > false return-code as it should if image is not available ?
> >
> > If I enter the URL directly in the browser, the result is the same,
> > browser search for
> > Minutes and does not return any error.
> >
> > Does anyone has experience with a similar problem, is there a timeout
> > that we can
> > Give to the function getimagesize() ?
> >
> > Your comments are very welcome and best regards
> >
> > Tks for your help
> > RCB845[/color]
>
> Trying ini_set('default_socket_timeout', ???).[/color]


Thank you for the suggestion, but unfortunately I cannot use it
due to PHP version we use. I think "default_socket_timeout" is only
available from 4.3 on.
Tks any and best regards
RCB845
Closed Thread