20 lines
549 B
PHP
20 lines
549 B
PHP
<?php
|
|
// File and new size
|
|
$filename = PATH_WWW.'img/degrade.png';
|
|
isset($_REQUEST['q'])? $percent = $_REQUEST['q'] : $percent = 0;
|
|
$percent = $percent/100;
|
|
|
|
// Get new dimensions
|
|
list($width, $height) = getimagesize($filename);
|
|
$new_width = $width * $percent;
|
|
$new_height = $height;
|
|
|
|
// Déclaration de la nouvelle image
|
|
$image = new Imagick($filename);
|
|
// Découper l'image
|
|
$image->cropImage($new_width, $new_height, 0, 0);
|
|
$image->setImageFormat('png');
|
|
/* Affichage de l'image avec les entêtes */
|
|
header('Content-type: image/png');
|
|
echo $image;
|
|
?>
|