Advertisement
lollhosh

Untitled

Apr 3rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2.  
  3. $ch = curl_init('https://i2.wp.com/www.fatosmorina.com/wp-content/uploads/2018/11/hello-world.png?ssl=1');
  4. $fp = fopen('placa.png', 'wb');
  5. curl_setopt($ch, CURLOPT_FILE, $fp);
  6. curl_setopt($ch, CURLOPT_HEADER, 0);
  7. curl_exec($ch);
  8. curl_close($ch);
  9. fclose($fp);
  10.  
  11. $im = imagecreatefrompng('placa.png');
  12.  
  13. if($im && imagefilter($im, IMG_FILTER_GRAYSCALE))
  14. {
  15. echo 'Image converted to grayscale.';
  16.  
  17. imagepng($im, 'placa_convertida.png');
  18. }
  19. else
  20. {
  21. echo 'Conversion to grayscale failed.';
  22. }
  23.  
  24. imagedestroy($im);
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement