Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. function isGIF($filename)
  3. {
  4. $filecontents = file_get_contents($filename);
  5. $str_loc = 0;
  6. $count = 0;
  7. while ($count < 2) {
  8. $where1 = strpos($filecontents, "\x00\x21\xF9\x04", $str_loc);
  9. if ($where1 === false) {
  10. break;
  11. } else {
  12. $str_loc = $where1+1;
  13. $where2 = strpos($filecontents, "\x00\x2C", $str_loc);
  14. if ($where2 === false) {
  15. break;
  16. } else {
  17. if ($where1+8 == $where2) {
  18. $count++;
  19. }
  20. $str_loc = $where2+1;
  21. }
  22. }
  23. }
  24. if ($count > 1) {
  25. return(true);
  26. } else {
  27. return(false);
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement