Guest User

Untitled

a guest
Dec 11th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. protected function _parsepng($file) {
  2. // Extract info from a PNG file
  3. $fopen = false;
  4. if ($fopen){
  5. $f = fopen($file, 'rb');
  6. if (!$f)
  7. $this->Error('Can't open image file: ' . $file);
  8. $info = $this->_parsepngstream($f, $file);
  9. fclose($f);
  10. return $info;
  11. } else {
  12. $f = fopen('php://temp', 'w+');
  13. $ch = curl_init();
  14. curl_setopt($ch, CURLOPT_URL, $file);
  15. curl_setopt($ch, CURLOPT_FILE, $f);
  16. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
  17. //curl_setopt($ch, CURLOPT_POST, 1);
  18. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  19. //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  20. //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  21. //curl_setopt($ch, CURLOPT_POSTFIELDS,[]);
  22. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  23. curl_exec($ch);
  24. if (!$f)
  25. $this->Error('Can't open image file: ' . $file);
  26. $info = $this->_parsepngstream($f, $file);
  27. curl_close($ch);
  28. return $info;
  29. }
  30. }
Add Comment
Please, Sign In to add comment