resize from one directory to another

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
creed

resize from one directory to another

Post 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" );
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: resize from one directory to another

Post 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" );
creed

Re: resize from one directory to another

Post 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
Post Reply