
Originariamente inviata da
vegasy
Ciao, sto eseguendo il tuo codice sul mio sito, per l'esattezza sto usando lo la classe Image, e mi ritrovo un problema non indifferente.
in pratica sembra che CreateSourceImage() non mi funzioni correttamente.
codice:
$result_img = $img->CreateSourceImage();
if( $result_img )
{
$img->SaveProportionateImage(_DIR_UPLOAD_FOTO.$foto_name, IMAGE_QUALITY, IMAGE_HEIGHT);
$img->SaveProportionateImage(_DIR_THUMB_FOTO.$foto_name, THUMB_QUALITY, THUMB_HEIGHT);
$img->Free();
$message = $msg_form_new[$_SESSION['lang']]['insert_ok'];
}
else
{
$message = $msg_form_new[$_SESSION['lang']]['file_not_valid'];
echo 'XXXXXXXXXXXXXXXXXXXXX';
}
in pratica con questo codice visualizzo sempre e solo l' echo, con qualsiasi immagine cerchi di caricare.
Ho scoperto che non mi crea la miniatura, quindi il problema lo trovo su questo pezzo di codice
codice:
function SaveProportionateImage($filename, $quality, $height)
{
$dest_height = $height;
$ratio = $this->src_height / $dest_height;
$dest_image = imagecreatetruecolor( $this->src_width / $ratio, $dest_height );
imagecopyresampled($dest_image, $this->src_image, 0, 0, 0, 0,
$this->src_width / $ratio,
$this->src_height / $ratio,
$this->src_width,
$this->src_height);
imagejpeg($dest_image, $filename.'.jpg', $quality);
imagedestroy($dest_image);
}