I have here one script that generate thumbnails.. but it did in the root folder, but i want that it take a original image in a folder called "img" and save the thumb file that it will create in folder called "thumbs" .. I am trying do that, but is not working
HELP PLEASE !!!
the code
Code: Select all
<?php
$imagem = "P1010060.jpg";
$thumbnail = explode('.', $imagem);
$thumbnail = $thumbnailї0]."_thumb.jpg";
$x = 150;
$y = 150;
$img_origem = ImageCreateFromJPEG($imagem);
$origem_x = imagesx($img_origem);
$origem_y = imagesy($img_origem);
$scale = min($x/$origem_x , $y/$origem_y);
if($scale < 1) {
$final_x = floor($scale*$origem_x);
$final_y = floor($scale*$origem_y);
$f_x = 0;
$f_y = 0;
}
$img_final = ImageCreatetruecolor($final_x,$final_y);
imagecopyresampled($img_final, $img_origem, $f_x, $f_y, 0, 0, $final_x, $final_y, $origem_x, $origem_y);
ImageJPEG($img_final, $thumbnail);
ImageDestroy($img_origem);
ImageDestroy($img_final);
?>