get image size from picture off another web server
Moderator: General Moderators
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
get image size from picture off another web server
how can you get the image size of an external picture located on another server?
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
if by "image size" you mean the dimensions of the picture, you'll have to load it with imagecreatefromjpeg() (or one of it's brothers) and then use imagesx() and imagesy()
I was using getimagesize() to check off site banner sizes to make sure they were a max of 480X60. Something like:
Code: Select all
$size = getimagesize($imageURL);
if ($size[0] > 468 || $size[1] > 60) {
// Reject it
}- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Just a note: getimagesize() returns a lot of information about a file if it reads as an image to PHP. Dimensions and image type are just a piece of the information returned.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact: