Page 1 of 1

Relative path and image variable concatenation not working

Posted: Thu Nov 15, 2007 5:02 pm
by Suzanne
Hi guys,

I have an upload form upload_form.html with a browse button and a field for the image name. The image is retrieved and saved with upload.php which calls test.cropinterface.php so the user can crop and save the uploaded image. However, when I pass the image variable from upload.php to test.cropinterface.php by $_GET['filename'], the filename will be displayed when I use echo $filename, but when I try to use a save or copy function, the error message lets me know that it cannot recognize an empty string. Please see my code for test.cropinterface.php below. Global variables is on and I am using a newer version of php.
<?php

header("Pragma: no-cache");
header('cache-control: no-store, must revalidate');

require('class.cropinterface.php')
$ci =& new CropInterface(true);

//this pass and variable call works

$filename=$_GET['filename'];
echo $filename;

if(isset($_GET['file'])
{
$ci->loadImage($_GET['file'];
//this pass and variable call does not work, but loadImage function does
//$filename=$_GET['filename'];
//echo $filename;
$ci->cropTo Dimensions($GET_['sx']. $GET_['sy'], $GET_['ex'], $GET_['ey']);

//this works and saves the cropped image to a relative path
$ci->saveImage("images/cropped.jpg", 100);

//this does not work and the error message states that it can't recognize filetype '../../Images/Thumbnails/Assemblages_Thumbs/'.


$ci->saveImage("../../Images/Thumbnails/Assemblages_Thumbs/".$filename, 100);
// I also tried
//$ci->saveImage("../../Images/Thumbnails/Assemblages_Thumbs/$filename",100);
//or
//copy("images/cropped.jpg", "../../Images/Thumbnails/Assemblages_Thumbs/".$filename);

}
?>
I guess the error means that the variable must be empty. However if I put "../../Images/Thumbnails/Assemblages_Thumbs/new.jpg" instead of "../../Images/Thumbnails/Assemblages_Thumbs/".$filename it works
I have been trying to get my head through this wall for the past 2 weeks. Its only gotten my headaches. So it would be soo great if someone would see what I am doing wrong here.