On my home-brewed forum, users can link to web images using the  
familiar [img]abc.jpg[/img] type tags.
Occasionally someone will link to something thats 1500px wide & all  
havoc breaks loose with the page format.

So I decided a simple way to limit this is to check the image size  
( getimagesize() ) & if its over 600px - then force it to be 600px max.
That's fine, but then i found if its a bad link or the web image is  
removed then the getimagesize() function fails with an error.

so then I thought I would first check if the file exists by using  
is_file()

That seems to work in some situations, but not others - eg: for some  
images over 600px hosted on remote servers is_file() works, on other  
servers it fails.

so I need a way to tweek the code below, perhaps ideally I can remove  
the is_file() & add a clause to getimagesize() that can skip the  
error if there's no file
getimagesize($iname) or die();

but obviously I dont want to die() - is there another way?

thx
Riquez

---------------------------------------------------
if(is_file($iname)){

        $picinfo = getimagesize($iname);
        $iw= $picinfo[0];
        $ih= $picinfo[1];
        if($iw>600){
                $iw=600;
                $ih=600;
        }
}
---------------------------------------------------


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to