How to generate Thumbnails with phpThumb and save it into a file?
- by CuSS
Hi all,
i wan't to know how to generate thumbnails with phpThumb Class, with an array with file paths already. And then Save the result of each image on other path but with the same name.
Thank you all ;)
EDIT:
I have my code something like this:
echo "A iniciar gerador de miniaturas para a área de cliente: \n";
include $wincli['files']['phpThumbClass'];
$files = file_list($wincli['dirs']['logos']);
$phpThumb = new phpThumb();
foreach( $files as $file ) {
echo " # A converter o ficheiro '".basename($file)."' : ";
if(is_file($file)){
$phpThumb->setSourceFilename($file);
$phpThumb->setParameter('w', 880);
$phpThumb->setParameter('h', 241);
$phpThumb->setParameter('q', 90);
$phpThumb->setParameter('zc', 1);
$outputFilename = $wincli['dirs']['logosthumbs'].$file;
if($phpThumb->GenerateThumbnail()){
if($phpThumb->RenderToFile($outputFilename)){
echo "OK \n";
}else{
echo "Falhou (Ao guardar no ficheiro)\n";
}
}else{
echo "Falhou (Ao gerar miniatura)\n";
}
}else{
echo "Falhou (Ficheiro inexistente)\n";
}
}