How to generate Thumbnails with phpThumb and save it into a file?
Posted
by CuSS
on Stack Overflow
See other posts from Stack Overflow
or by CuSS
Published on 2010-05-25T17:50:49Z
Indexed on
2010/05/26
12:01 UTC
Read the original article
Hit count: 414
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";
}
}
© Stack Overflow or respective owner