#42 - PHP image resize

Data: 2019-01-05 12:00 - PHP

PHP image resize code.

<?php
$dst_width = 384;
$dst_height = 216;
$image = imagecreatefrompng("$name.png");
$dst = imagecreatetruecolor($dst_width, $dst_height);
imagecopyresampled($dst, $image, 0, 0, 0, 0, $dst_width, $dst_height, imagesx($image), imagesy($image));
imagepng($dst, "$name$dst_height.png");

Previous snippet | Next snippet