Vengono memorizzati in una cartella "thumbs" e dato che come nome del file viene utilizzato l'attach_id sono facilmente individuabili e associabili ai rispettivi Topics.
Codice: Seleziona tutto
function resize_thumbs($physical,$attach_id){
$img_des = $phpbb_root_path . "thumbs/" . $attach_id . ".jpg" ;
// Ottengo le informazioni sull'immagine originale
list($width, $height, $type, $attr) = getimagesize($phpbb_root_path . "files/" . $physical);
// Creo la versione ridimensionata dell'immagine (thumbnail)
// Modificare il valore di $new_height per ottenere thumbs di altezza diversa
// (la larghezza si adatta in proporzione)
$new_height = '115' ;
$new_width = ($width * $new_height / $height);
$thumb = imagecreatetruecolor($new_width, $new_height);
$source = imagecreatefromjpeg($phpbb_root_path . "files/" . $physical);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Salvo l'immagine ridimensionata
imagejpeg($thumb, $img_des, 75);
return "thumbs/". $attach_id . ".jpg" ;
}