<?php
// Le fichier
$filename = $_GET['img'];
$percent = 0.15;

// Content type
header('Content-Type: image/jpeg');

// Calcul des nouvelles dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;

// Redimensionnement
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);


// Création de quelques couleurs
$white = imagecolorallocate($image_p, 255, 255, 255);
$grey = imagecolorallocate($image_p, 128, 128, 128);
$black = imagecolorallocate($image_p, 0, 0, 0);
imagefilledrectangle($image_p, 0, 0, $new_width, 19, $white);

// Le texte à dessiner
$text = basename($filename, ".jpg");
// Remplacez le chemin par votre propre chemin de police
$font = 'arial';

// Ajout d'ombres au texte
//imagettftext($image_p, 20, 0, 11, 21, $grey, $font, $text);

// Ajout du texte
imagettftext($image_p, 10, 0, 10, 15, $black, $font, $text);



// Affichage
imagejpeg($image_p, null, 100);

// readfile("/Users/serve/Downloads/image01.jpg" );
 //readfile("/Users/serve/Downloads/". $_GET['img'] );
 //imagejpeg(resize ($_GET['img'],200,200), null, 100);
 //readfile($_GET['img']);
//echo "/img/" . $_GET['img'];
?>