Re: [PHP] FUNCTION TO CHECK IMAGE
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. thank you for your input, it really helps. Semarakkan kemerdekaan RI ke 61 th dengan ikut bermain netkuis 17-an di http://netkuis.telkom.net/17an/ Kumpulkan poin sebanyak-banyaknya. Dan siap-siap tunggu rejeki dari sponsor kami. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
BBC wrote: Hi all. I'm having a problem regarding image handling. Sometimes an image can be showed in browser normally (in my computer) but when I upload it into my site that image is not valid, so there is an issue in my getimagesizes() function. Is there any function to recover such problem? I used if(file_exists($image_path)) but it couldn't solve the problem. Input would be appreciated - From what it sounds like you are doing, you are uploading a file through some form, then manipulating it's size. Is this correct? Yes it is, but the uploading was going well (size is ok). When I show the image on the web using getimagesizes(), 'sometimes' such image size couldn't be resolved. Is there any function to define that image is ok or not? What happens when you stop manipulating it's size and try to view just the uploaded file? Size of image (after or before uploading) would be same. but the issue still there (sometimes) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
At 12:49 AM -0700 9/10/06, BBC wrote: Hi all. I'm having a problem regarding image handling. Sometimes an image can be showed in browser normally (in my computer) but when I upload it into my site that image is not valid, so there is an issue in my getimagesizes() function. Is there any function to recover such problem? I used if(file_exists($image_path)) but it couldn't solve the problem. Input would be appreciated How are you uploading your image? I upload a file through some form then I manipulate it's size What is reporting your image is not valid? Size of image can't be define seem's like the image is not there, but it's not happened all the time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
At 11:40 PM -0700 9/10/06, BBC wrote: At 12:49 AM -0700 9/10/06, BBC wrote: Hi all. I'm having a problem regarding image handling. Sometimes an image can be showed in browser normally (in my computer) but when I upload it into my site that image is not valid, so there is an issue in my getimagesizes() function. Is there any function to recover such problem? I used if(file_exists($image_path)) but it couldn't solve the problem. Input would be appreciated How are you uploading your image? I upload a file through some form then I manipulate it's size Don't manipulate it's size and see if that works. Size of image can't be define seem's like the image is not there, but it's not happened all the time. Can't help with sporadic problems -- that's probably a logic error. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 BBC wrote: BBC wrote: Hi all. I'm having a problem regarding image handling. Sometimes an image can be showed in browser normally (in my computer) but when I upload it into my site that image is not valid, so there is an issue in my getimagesizes() function. Is there any function to recover such problem? I used if(file_exists($image_path)) but it couldn't solve the problem. Input would be appreciated - From what it sounds like you are doing, you are uploading a file through some form, then manipulating it's size. Is this correct? Yes it is, but the uploading was going well (size is ok). When I show the image on the web using getimagesizes(), 'sometimes' such image size couldn't be resolved. Is there any function to define that image is ok or not? What happens when you stop manipulating it's size and try to view just the uploaded file? Size of image (after or before uploading) would be same. but the issue still there (sometimes) What types of images are these? JPG, PNG, GIF? - -- Christopher Weldon, ZCE President CEO Cerberus Interactive, Inc. [EMAIL PROTECTED] 979.739.5874 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFBaLsZxvk7JEXkbERAg62AJ4iWogZyWry445xv6bT8ld6Mfw79ACgkWhx zfIJGqxli9pHPHrcHoi8FjI= =sllc -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
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();? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
-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. [EMAIL PROTECTED] 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
[PHP] FUNCTION TO CHECK IMAGE
Hi all. I'm having a problem regarding image handling. Sometimes an image can be showed in browser normally (in my computer) but when I upload it into my site that image is not valid, so there is an issue in my getimagesizes() function. Is there any function to recover such problem? I used if(file_exists($image_path)) but it couldn't solve the problem. Input would be appreciated Best Regards BBC **o0o** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
At 12:49 AM -0700 9/10/06, BBC wrote: Hi all. I'm having a problem regarding image handling. Sometimes an image can be showed in browser normally (in my computer) but when I upload it into my site that image is not valid, so there is an issue in my getimagesizes() function. Is there any function to recover such problem? I used if(file_exists($image_path)) but it couldn't solve the problem. Input would be appreciated How are you uploading your image? What is reporting your image is not valid? tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FUNCTION TO CHECK IMAGE
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 BBC wrote: Hi all. I'm having a problem regarding image handling. Sometimes an image can be showed in browser normally (in my computer) but when I upload it into my site that image is not valid, so there is an issue in my getimagesizes() function. Is there any function to recover such problem? I used if(file_exists($image_path)) but it couldn't solve the problem. Input would be appreciated Best Regards BBC **o0o** - From what it sounds like you are doing, you are uploading a file through some form, then manipulating it's size. Is this correct? What happens when you stop manipulating it's size and try to view just the uploaded file? - -- Christopher Weldon, ZCE President CEO Cerberus Interactive, Inc. [EMAIL PROTECTED] 979.739.5874 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFBDkiZxvk7JEXkbERArmiAJwLuA2Kk52/uhT6y8ptKEi/D6nkWQCcDa2M R0uKdIwEaPBGBc14AoZQzo4= =epdR -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php