Page 1 of 1

createimage in folder

Posted: Mon May 17, 2004 7:38 pm
by molandim
Hi folks.

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&#1111;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) &#123; 
$final_x = floor($scale*$origem_x);
$final_y = floor($scale*$origem_y); 
$f_x = 0; 
$f_y = 0; 
&#125;

$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);

?>

Posted: Tue May 18, 2004 11:37 am
by lostboy
in the image name, include the path to the new folder