Re: Watermark with GD
| From: | tedd | Date: | Sun, 31 Oct 2010 15:42:46 +0000 |
| Subject: | Re: Watermark with GD | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309175@lists.php.net to get a copy of this message | ||
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. GaryGary: 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/