sql into variable only half works
Posted: Thu May 18, 2006 5:07 pm
Jcart | Please use
I've spent hours with two other coders I know trying to get this to work. The problem is if you echo $savefile you get "gallery_images/thumbs/tn_file.jpg", but as soon as you run it into the saveImage() function it doesn't work. It will only read if your lucky up to the end of the prefix... I've had it save tn_ as a filename a few times, but never the end.
I've tried a million different ways of making $savefile, I've tried mysql_get_rows and mysql_get_arrays and i'm convinced its taht section of code that is doing it. It will echo fine but not in saveImage. If I cut what it echos and put it into saveimage where the $savefile would be it works... I've tried changing the field type that 'filename' is stored in in my mysql table but no luck.
I hope I explained myself well enough, I'm pullling my hair out over this b*****d! I hate the days when the small problems get in the way of the fun work. Cheers for any help in advance... I'm completey stuck.
-Leonard
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Greetings,
This is my first post here, and as much as I'd like it to be starting off giving someone help its quite the opposite.
My problem is this. I've been trying to make a gallery system where you can upload images, crop the thumbnail and store all teh image data and comments in a mysql table. I've got a great script I found to cut out the thumbnails and have been integrating it into my scripts. The script takes all the file data, uploads the file, adds all the data to the mySQL database and tehn on the cropping script takes the desired filename from the database and uses that to name the thumb nail... Here is the script I haveCode: Select all
$tn_gallocation = "gallery_images/thumbs" ;
$tn_prefix = "tn_" ;
$date = $_POST['date'] ;
$query = "SELECT id, filename FROM burt0n_thelab.images WHERE timestamp = '$date'" ;
$result = $db->readquery($query);
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_array($result);
$i = $row[0] ;
$destfile = $row['filename'] ;
$ci = new cropInterface();
$savefile = "$tn_gallocation/$tn_prefix" . "$destfile" ; //THE DESTFILE IS GIVING IT PROBLEMS
//$savefile = "$destfile";
//echo "$destfile" ;
//echo "$savefile" ;
if ($_GET['file'])
{
$ci->loadImage($_GET['file']);
$ci->cropToDimensions($_GET['sx'], $_GET['sy'], $_GET['ex'], $_GET['ey']);
header('Content-type: image/jpeg');
$ci->showImage('jpg', 100);
$ci->saveImage("$savefile", 100) ;
exit;
}I've tried a million different ways of making $savefile, I've tried mysql_get_rows and mysql_get_arrays and i'm convinced its taht section of code that is doing it. It will echo fine but not in saveImage. If I cut what it echos and put it into saveimage where the $savefile would be it works... I've tried changing the field type that 'filename' is stored in in my mysql table but no luck.
I hope I explained myself well enough, I'm pullling my hair out over this b*****d! I hate the days when the small problems get in the way of the fun work. Cheers for any help in advance... I'm completey stuck.
-Leonard
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]