Guest User

Untitled

a guest
Aug 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. PHP test for corrupt (but apparently fine) images
  2. //check if our image is OK
  3. if ($image && $imageThumb)
  4. {
  5. //check if image is a jpeg
  6. if (exif_imagetype($_FILES[$k]['tmp_name']) == IMAGETYPE_JPEG)
  7. {
  8. list($width, $height, $type, $attr) = getimagesize($_FILES[$k]['tmp_name']);
  9. //echo 1;
  10. $image = new SimpleImage();
  11. //echo 2;
  12. $image->load($_FILES[$k]['tmp_name']);
  13. //echo 3;
  14. $imageThumb = new SimpleImage();
  15. //echo 4;
  16.  
  17. //this next line topples my script, but only for that one image - why?:
  18. $imageThumb->load($_FILES[$k]['tmp_name']);
  19. //echo '5<br/><br/>-------<br/>';
  20. //do stuff, save & update db, etc
  21. }
  22. }
Add Comment
Please, Sign In to add comment