Re: Watermark with GD
| From: | Gary | Date: | Sun, 31 Oct 2010 16:12:31 +0000 |
| Subject: | Re: Watermark with GD | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309178@lists.php.net to get a copy of this message | ||
"tedd" <tedd.sperling@gmail.com> wrote in message
news:p06240800c8f339e20870@[192.168.1.2]...
> At 9:19 AM -0400 10/31/10, Gary wrote:
>>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.
>>
>>Gary
>
> Gary:
>
> Both locations? I think you are confusing yourself.You either have the
> images stored in the database OR the file system, but not both.
>
> However, I think you have the images stored as files within the file
> directory, such as:
>
> http://yourdomain.com/images/picture1.jpg
>
> Now, in your database you should have only the path name stored (i.e.,
> images/picture1.jpg) and not the image. However, I usually only store the
> file names and NOT the path. That way I can move the images to where ever
> I want and only change their reference in the HTML.
>
> To recap, to show any image you use the HTML img tag, such as:
>
> <img src="images/picture1.jpg">
>
> To tie this statement to a database, you need to pull out the image name
> (or file path) from the database and use that. Something like this:
>
> $query = "SELECT file_name FROM pictures WHERE id = '$id' ";
> $result = mysql_query($query) or die();
> $row = mysql_fetch_array($result);
> $file_name = $row['file_name'];
>
> And then in the HTML you would use:
>
> <img src="images/<?php echo($file_name);?>">
>
> If you can get to this part, then we can deal with placing a watermark on
> the image before showing it.
>
> Please let me know when you get this part to work.
>
> Cheers,
>
> tedd
>
> PS: There is no need to use a LONG BLOB in your database -- that's just a
> waste of space.
>
> --
> -------
> http://sperling.com/
tedd
Thank you for your reply.
I have the images being displayed in the browser fine, my issue was that I
was not able to get the watermark to show up. I believe the issue was here
$img=imagecreatefromjpeg($_GET['pic']);
in that 'pic' is asking for the image that I wanted the watermark displayed
on, and what I put in did not work. Since the image file name is being
stored in the DB, I tried
$row_WADAimages["image_file"]
as well as a few others.
What do you suggest I changed "longblob" to, and is it safe to do so?
Again, thank you for your help.
gary
__________ Information from ESET Smart Security, version of virus signature database 5579 (20101031)
__________
The message was checked by ESET Smart Security.
http://www.eset.com