3v4l.org

run code in 300+ PHP versions simultaneously
<?php function resizeImg($img, $width, $height, $path) { $i = new Imagick($img); $i->scaleImage($width, $height); $gig = $i->getImageGeometry(); if(($gig['width']/$width) < ($gig['height']/$height)) { $i->cropImage($gig['width'], floor($height * $gig['width'] / $width), 0, (($gig['height'] - ($height * $gig['width'] / $width)) / 2)); } else { $i->cropImage(ceil($width * $gig['height'] / $height), $gig['height'], (($gig['width'] - ($width * $gig['height'] / $height)) / 2), 0); } $i->ThumbnailImage($width, $height,true); $i->setImageFormat("jpeg"); $i->setImageCompressionQuality(90); $i->writeImage($path); return $i->getimage(); }
Output for git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.43 ms | 401 KiB | 8 Q