Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // change these variables to your values
- $orig_width = 854;
- $orig_height = 480;
- $new_width = 2;
- $orig_filename = 'original.png';
- // code
- $new_height = $orig_width / $new_width * $orig_height;
- $orig_image = imagecreatefrompng($orig_filename);
- $new_image = imagecreatetruecolor($new_width, $new_height);
- for ($i = 0; $i < $orig_width / $new_width; $i++) {
- imagecopy($new_image, $orig_image, 0, $i * $orig_height, $i * $new_width, 0, $new_width, $orig_height);
- }
- header('Content-type: image/png');
- imagepng($new_image);
- imagedestroy($orig_image);
- imagedestroy($new_image);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment