Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-09-2006, 12:16 PM Uploading images?
Extreme Talker

Posts: 219
Location: UK, East Anglia
Trades: 0
I made script that allows members to upload an avatar for the forums but i want to add something to it that will check that the image is 64px by 64px and that the file size isn't too big. How can i do this?
timsquash5 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-09-2006, 05:27 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
If you have the GD libraries available (a lot of hosts already do), you can use them to do this:

PHP Code:
$image imagecreatefromjpeg($filename);
//or
$image imagecreatefromgif($filename); 
^ This will get you a handle to the image, you an use the filetype($filename) function to determine whether it is a gif, jpeg, png, bmp or whatever, and call the right creation function ( a complete list is here:
http://www.php.net/manual/en/ref.image.php )

imagesx($image) will get you the width and imagesy($image) will get you the height in pixels.

filesize($filename) will give you the filesize (in bytes I think).
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to Uploading images?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.78982 seconds with 12 queries