PDA

View Full Version : Image resize


buildrebuild
06-17-2008, 07:28 PM
Hi,

I am testing an image cropper and php script locally on my computer. The cropper is Flash and after pressing the crop button a php script processes the information. Here is the php processing script...

<?php
include_once "class.cropcanvas.php";

$img = new scmsImage();//$img = new scmsImage(true);<--DEBUGMODE


$img->loadImage("../".$_POST['file']);
$img->redimToPercent ( $_POST['scale'],$_POST['scale'] );
$img->applyChangesToOriginal();
$img->cropToDimensions ($_POST['x1'],$_POST['y1'],$_POST['x2'],$_POST['y2']);

header("Content-type: image/jpeg");

$img->showImage("jpg");

?>

This page loads with the image in it but when I click to see where the image resides the URL is "http://127.0.0.1/image_cropper/cgi/process.php"

I assume the image isn't actually saved, but this is what I need it to do. Can you please help me save the image.

Thanks.
C

Iszak
06-17-2008, 07:40 PM
You've got to tell us the class and show it to us. I'll assume you're using this class http://www.phpclasses.org/browse/file/3757.html which you didn't specify and I found via google on your class name. You use the function they have made called saveImage(); with the parameters $filename, $quality and $forcetype.

buildrebuild
06-17-2008, 08:25 PM
Thanks Iszak,

I downloaded all the files and the cropping works, but the saving of the file doesn't.

This is what I have...

if (isset($_GET['file'])) {
$ci->loadImage($_GET['file']);
$ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
$ci->showImage('jpg', 100);
$cc->saveImage(dirname(__FILE__). '/final2.jpg', 90);
exit;
}

Any help much appreciated.

Best,
C