On Oct 30, 2010, at 9:31 AM, Gary wrote:
"tedd" <[email protected]> wrote in message news:p06240800c8f1d19b9...@[192.168.1.2]...At 3:05 PM -0400 10/29/10, Gary wrote:I am trying to get the watermark to work, however I am having a problem inthat the image is being called from a database (image sits in images file). The script in question is this $image = imagecreatefromjpeg($_GET['src']); However it produces an error message ofWarning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: Filename cannot be empty in /home/content/a/l/i/alinde52/html/ imagesDetail.php online 233I have tried various methods, for example: ($_GET ['images/'] or ($_GET['images/$row_WADAimages["image_id"]]. Can anyone shed some light on this for me. Thank you GaryGary: Several things.1. Getting an image from a database? You mean that you are getting thepath of the image in the file system, right?Side note: You could place the image inside the database using a BLOB anddo away with the path all together. That has the benefit of beingportable -- you simply move the database to where ever you want it. The downside is that the database becomes very large, but no more so that thefile system. There are pro's and con's in storing actual images in a database. 2. Using a GET is not the way to get the path. Instead, you have to retrieve the path from the database table where the path is stored --and that requires a MySQL query similar to "SELECT * FROM <database> WHERE id=<whatever>". There are lot's of examples of how to pull data from adatabase. 3. After getting the path, then you can create the watermark like so: http://webbytedd.com/b/watermark/ Hope this helps, tedd -- ------- http://sperling.com/tedd Thank you for your reply. I was under the impression that the image is stored in a folder calledimages, in fact the images file do go in, however I have the DB set up for longblob, averaging about 20kb each, so now I am unsure. I exported the sqlso perhaps you can tell me. Table structure for table `images` -- CREATE TABLE IF NOT EXISTS `images` ( `image_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `caption` varchar(50) NOT NULL, `wheretaken` varchar(100) NOT NULL, `description` text NOT NULL, `file_name` varchar(25) NOT NULL, `image_file` longblob NOT NULL, `submitted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`image_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1447 ;When I call the images, which works fine, I do need to specify the path thatleads to the images folder. Am I being redundant in this structure.This is the script that I use to call the images. I have pulled out some ofthe html that styles the data.<?php if ($totalRows_WADAimages > 0) { // Show if recordset not empty ?><?php echo $row_WADAimages["caption"]; ?> src="images/<?php echo $row_WADAimages["image_file"]; ?>" <?php echo $row_WADAimages["description"]; ?>" <?php echo $row_WADAimages["where_taken"]; ?> <?php echo $row_WADAimages["description"]; ?> Thank you for your help. Gary
is this the imageDetail.php script?From what it appears in the code, `image_file` is holding the file name rather than the actual image. Yet you have `image_file` defined as a longblob, which would make sense if you were storing the actual image data in the data base rather than on the file system. As Ashley noted, you can do it either way. I notice you also have a field `file_name` -- what is this used for? It sounds like your design is a bit off -- neither one way or the other. The php shown doesn't look complete enough, though -- where is the img tag and such? Also, going in and out of php on each line is kind of a waste and looks sloppy. If i read that code right, it would emit something like this:
caption text
src="images/pathtoimagefile" description text
where taken text
description text
Look at the html that's emitted from the script and see if that's what
you get.
Can you post or pastebin more of the .php script so I can see more of what is going on?
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

