Skip to content

Instantly share code, notes, and snippets.

@maagmirror
Created September 23, 2020 19:31
Show Gist options
  • Save maagmirror/8bd06fa785d26870b59d4321fcfa2674 to your computer and use it in GitHub Desktop.
Save maagmirror/8bd06fa785d26870b59d4321fcfa2674 to your computer and use it in GitHub Desktop.
dummy php to resize images with url
<?php
$img = $_GET['img'];
$height = $_GET['height'];
$width = $_GET['width'];
$remote_file = $img;
$new_width = $width;
$new_height = $height;
list($width, $height) = getimagesize($remote_file);
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($remote_file);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
header('Content-Type: image/jpeg');
imagejpeg($image_p, NULL, 100);
imagedestroy($image_p);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment