Page 1 of 1

resize from one directory to another

Posted: 2008-06-01T05:49:54-07:00
by creed
Hello, using the command line with PHP, I am trying (without success) to resize an uploaded image to another folder. I can do it in the same folder but not to another one. I struggled with this for about 4 hours yesterday, searching, trying and finally gave up. I found the path option at the website but no examples of use.

function resize_image($uploaded_file, $imgdir, $newimage, $image_size, $path)
uploaded_file = org_img.jpg
imgdir = ../1/2/lg
newimage = org_img.jpg
imagesize = 100
path = ../1/2/sm

$filename = $imgdir . "/" . $uploaded_file;
$path = " -path $path ";

exec ( "convert $filename -resize " . $height ."x" . $width ."$path $newimage" );

Re: resize from one directory to another

Posted: 2008-06-01T07:08:41-07:00
by Bonzo
What does this do ?

Code: Select all

function resize_image($uploaded_file, $imgdir, $newimage, $image_size)
uploaded_file = org_img.jpg
imgdir = ../1/2/lg
newimage = ../1/2/sm/org_img.jpg
imagesize = 100

$filename = $imgdir . "/" . $uploaded_file;

exec ( "convert $filename -resize {$height}x{$width} $newimage" );

Re: resize from one directory to another

Posted: 2008-06-01T07:46:04-07:00
by creed
Hello Bonzo...That will work. I see now what my tired eyes couldn't see yesterday :lol:
It was my quotes :? see below your quote...and thanks a million for your reply.
Bonzo wrote:What does this do ?

Code: Select all

function resize_image($uploaded_file, $imgdir, $newimage, $image_size)
uploaded_file = org_img.jpg
imgdir = ../1/2/lg
newimage = ../1/2/sm/org_img.jpg
imagesize = 100

$filename = $imgdir . "/" . $uploaded_file;

exec ( "convert $filename -resize {$height}x{$width} $newimage" );

Code: Select all

$path = "../1/2/sm/";
if( empty($path) ){
  $path = "";
  $newfile = $imgdir . "/" . $newimage;
}else{
  $newfile = $newimage;
}
exec ( "convert $filename -resize " . $height ."x" . $width ." " . $path . $newfile );
In cases of main or sub groups the original image is resized to a thumb(group_1_t.jpg) in the same folder, and then an attempt is made to delete the original.

I'm working on a photo gallery system on my own nickel, so I can plug it into any site in the future. Working example of plugin is here: www.landcoast.com/gallery/lciigallery.php
or simply www.landcoast.com/gallery/

I'm working on the backend admin now and have finally got where I need to be, Yay.

Thanks,
John L. Creed
pcExpressWay Consulting
Pasadena, TX.
www.pcexpressway.com