On Sat, 2010-10-30 at 11:50 -0400, Gary wrote:

> "tedd" <tedd.sperl...@gmail.com> wrote in message 
> news:p06240804c8f1eaf38...@[192.168.1.2]...
> > At 10:31 AM -0400 10/30/10, Gary wrote:
> >>
> >>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.
> >
> > Gary:
> >
> > Impressions don't cut it -- you should *know* if the actual images are in 
> > the file system or in the database. Find that out before we can proceed.
> >
> > Cheers,
> >
> > tedd
> >
> >
> > -- 
> > -------
> > http://sperling.com/
> 
> tedd
> 
> The images do go into the images folder, what I am now unclear about is 
> where they are being called from.
> 
> 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
> 
> 
> 
> 
> 


OK, what it looks like is that the path to your image file is being
stored in the database, and you're outputting that path inside of an
<img> tag when you output the HTML. That's fine, and is the method I use
all the time.

Now, back to the original question. You want to overlay some text on it
as a watermark? For that, you need to use the GD functions.

First, use GD to load in the image. Note that the path you use to open
the image here won't be the same as the one you have in the DB. That's
because the one in the DB is the path that is available to web browsers
to reference your image, which is uses relative to your web page. For
example, if your page was at
http://www.someplace.com/somefolder/page/php, and the image tag looked
like <img src="images/image.jpg"/> the browser path to the images would
be http://www.someplace.com/somefolder/image.jpg , but the script path
to your image would be very different, such as one of the following:


      * c:\xampp\htdocs\websitename\somefolder\images\image.jpg (xampp
        on windows)
      * /var/www/html/websitename/somefolder/images/image.jpg (linux)
      * /srv/www/websitename/somefolder/images/image.jpg (linux)
      * /home/websitename/somefolder/images/image.jpg (linux)


Those are only examples, and may not necessarily be the exact setup you
have on your server, you should find out exactly what the server is
running. You can also reference it via a relative path, which is
relative to the PHP script.

With GD, you can either save a duplicate of the image with the watermark
on, with a useful name such as watermark_image.jpg, or you can output it
directly with the proper headers. If you do choose the latter route, you
should ideally make a separate image script for making the watermark
image, and in your image tag, call it with something like:

<img src="image.php?image_id=id"/>

The id can be whatever id you've got for the image in your database, and
then in your image.php script, make the DB call that grabs the
information for that image, and create the watermark. Just remember to
make sure you send the right headers or your image won't show!

Thanks,
Ash
http://www.ashleysheridan.co.uk


Reply via email to