Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Size 1

Status
Not open for further replies.

charlie12345

Technical User
Mar 4, 2001
28
US
Maybe not a php question, but is there a way to determine the size of an image before I display it? If its too large I'd like to limit its size on the page.
 
hi charlie

try this :



$file_name = "somefile.jpg" ;

$file_size = filesize($file_name) ;

echo "File Size: " . $file_size ;



it will give u file size in bytes

cheers

spookie
 
What I'm looking for is the image size, e.g., 400x200.
All I have is the URL.
 
Go to
PHP's image functions are fairly limited unless you have the GD module installed, but fortunately the functions to READ information are available with or without GD. (GetImageSize is the function you will be looking for). -------------------------------------------

"Calculus is just the meaningless manipulation of higher symbols"
                          -unknown F student
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top