Guest User

Untitled

a guest
May 21st, 2015
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2. // change these variables to your values
  3. $orig_width = 854;
  4. $orig_height = 480;
  5.  
  6. $new_width = 2;
  7.  
  8. $orig_filename = 'original.png';
  9.  
  10. // code
  11. $new_height = $orig_width / $new_width * $orig_height;
  12.  
  13. $orig_image = imagecreatefrompng($orig_filename);
  14. $new_image = imagecreatetruecolor($new_width, $new_height);
  15.  
  16. for ($i = 0; $i < $orig_width / $new_width; $i++) {
  17.     imagecopy($new_image, $orig_image, 0, $i * $orig_height, $i * $new_width, 0, $new_width, $orig_height);
  18. }
  19.  
  20. header('Content-type: image/png');
  21. imagepng($new_image);
  22. imagedestroy($orig_image);
  23. imagedestroy($new_image);
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment