Tramite il manuale in linea ho creato questo codice che sembra fuzionare alla perfezione... tranne per il fatto che mi crea immagini tutte nere.
Qualcuno ha mai avuto un problema simile o sa come risolverlo?
Grazie!
codice:
<?php
// File and new size
$filename = $patch;
$percent = 0.5;
// Content type
header('Content-type: image/jpeg');
// Get new sizes
list($width, $height) = getimagesize($filename);
if ($width > $height){
$height = $height * 50;
$newheight = $height / $width;
$newwidth = 50;
}
else {
$width = $width * 50;
$newwidth = $width / $height;
$newheight = 50;
}
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thumb);
?>