-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 BBC wrote: >> What types of images are these? JPG, PNG, GIF? > Its jpg. Look... I don't know exactly what your point, I'm just asking you about the function to resolve the size of image like the > codes below: > if (file_exists($img_path)){ > list($width,$height) = getimagesizes($img_path); > }else{ > $width = $ height = $max_size; > } > So is there any other option to replace file_exists();? > Well, if I do remember correctly, then you are uploading a file. If that's the case, then rather than using file_exists() you should be using is_uploaded_file. Once you've verified that is_uploaded_file() returns true, then use move_uploaded_file() to move the file to someplace on your filesystem. If that returns true, then you should not have to check file_exists again and just be able to use get getimagesize(). So, a good function for this would probably be: function getUploadedImageSize($image, $to_path) { global $max_size; $width = $height = $max_size; if (is_uploaded_file($image)) { if (move_uploaded_file($image, $to_path)) { list($width,$height) = getimagesize($to_path); } } return array($width, $height); } list($width, $height) = getUploadedImageSize($tmp, '/the/final/path'); BTW, I don't know if you did a copy and paste from your code or if you just typed it in really quickly, but you do have a few syntactical errors in the code above. First, the image sizing function is getimagesize - singular, not plural. Second, in your assignment statement, you have a space where there should not be one: $width = $ height = $max_size; ^ Just wanted to make sure you knew about that in case it was copied and pasted. - -- Christopher Weldon, ZCE President & CEO Cerberus Interactive, Inc. cweldon@xxxxxxxxxxxxxxxxxx 979.739.5874 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFBjDqZxvk7JEXkbERAr3XAKCXlgni7S6KuHAOY9ch7O9AkRBmEgCfcd6u Oc1YRxq4EhHkeJpspLW0RdU= =Kxek -----END PGP SIGNATURE----- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php