Re: Watermark with GD

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

 



At 12:12 PM -0400 10/31/10, Gary wrote:
"tedd" <tedd.sperling@xxxxxxxxx> 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

gary:

At some point you're going to have to learn:

1. The difference between a VARCHR and a LONGBLOB. Question: If you are simply storing the name of an image file, then why use a LONGBLOB to do that? Please look up the difference between the two and post your findings here;

2. The GET (again) is *not* the way to get the name of the image. I have shown you how to pull the name of the image via a database call -- so why do you go back to your old code telling me what the problem is? If you already know what the problem is, then why ask me?

3. If you want my help, then use what I have shown you instead of going back to your past problematic solution.

It looks to me as if you are not willing to learn but rather are looking for a simple solution. I am not going to write your code for you.

Now, please use my last email and write code to present an image as I demonstrated to you. When you can do that, then we can address how to put a watermark on the image. However, if you fail to do that and continue to bring up old nonsensical code, then I will discontinue commenting re this thread.

Cheers,

tedd

--
-------
http://sperling.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