"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 in
>>that 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 of
>>
>>Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: Filename
>>cannot be empty in /home/content/a/l/i/alinde52/html/imagesDetail.php on
>>line 233
>>
>>I 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
>>
>>Gary
>
> Gary:
>
> Several things.
>
> 1. Getting an image from a database? You mean that you are getting the
> path of the image in the file system, right?
>
> Side note: You could place the image inside the database using a BLOB and
> do away with the path all together. That has the benefit of being
> portable -- 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 the
> file 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 a
> database.
>
> 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 called
images, 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 sql
so 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 that
leads 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 of
the 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
__________ Information from ESET Smart Security, version of virus signature
database 5576 (20101029) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php