Re: Watermark with GD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tamara

I realized I forgot to answer your question about file_name.  It is a text 
field that the photographer enters the name of the image file for easy 
reference.  He does not have access to the DB and he is inserting the images 
from a form I created.

I was sure that the images were being stored and called from the images 
folder and not directly from the DB, that is until tedd brought it up.  I 
did have an issue of getting the images to show in the beginning, however I 
solved it by inserting the path in the call from the DB.  I am wondering now 
if they are stored in both locations.

Thank again

Gary

"Tamara Temple" <tamouse.lists@xxxxxxxxx> wrote in message 
news:94DF613C-6B40-4897-B101-21CF7D83A763@xxxxxxxxxxxx
>
> On Oct 30, 2010, at 9:31 AM, Gary wrote:
>
>>
>> "tedd" <tedd.sperling@xxxxxxxxx> wrote in message
>> news:p06240800c8f1d19b992f@[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
>
> 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?
>
>
>
> __________ Information from ESET Smart Security, version of virus 
> signature database 5576 (20101029) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__________ Information from ESET Smart Security, version of virus signature database 5578 (20101031) __________

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux