getimagesize() function problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rcb845@yahoo.fr

    getimagesize() function problem

    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

    #2
    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($so urce)
    ? list($width, $height, $type, $attrib) = getimagesize($s ource)
    : die('Unable to locate a required script: '.$source);

    Comment

    • Chung Leong

      #3
      Re: getimagesize() function problem

      <rcb845@yahoo.f r> wrote in message
      news:18b577b2.0 502160417.29630 50e@posting.goo gle.com...[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('defaul t_socket_timeou t', ???).


      Comment

      • rcb845@yahoo.fr

        #4
        Re: getimagesize() function problem

        DH <doug861@comcas t.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($so urce)
        > ? list($width, $height, $type, $attrib) = getimagesize($s ource)
        > : 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

        Comment

        • rcb845@yahoo.fr

          #5
          Re: getimagesize() function problem

          "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message news:<X9mdncMz_ uZUfo7fRVn-qA@comcast.com> ...[color=blue]
          > <rcb845@yahoo.f r> wrote in message
          > news:18b577b2.0 502160417.29630 50e@posting.goo gle.com...[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('defaul t_socket_timeou t', ???).[/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

          Comment

          Working...