Skip to content

Instantly share code, notes, and snippets.

@nyg
Last active February 27, 2024 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyg/ef6293c31030276968dee1cb4b6b3efa to your computer and use it in GitHub Desktop.
Save nyg/ef6293c31030276968dee1cb4b6b3efa to your computer and use it in GitHub Desktop.
Enlarge a given image.
<?php
$filename = $argv[1];
$growthFactor = $argv[2];
list($width_orig, $height_orig) = getimagesize($filename);
$width = $width_orig * $growthFactor;
$height = $height_orig * $growthFactor;
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefrompng($filename);
imagecopyresized($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagepng($image_p, null);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment