PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Problems:
#1. I need the watermarked image to be created dynamically on a text/html page. Can you specify two header content-types? Such as image/jpeg and text/html.
#2. When trying to save the image, the image name is 'watermark.jpg'.. how would I preserve the original filename?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
1: not possible. HTML and images are passed in seperate streams from the server to client.
2: You need to write a script that just outputs the image to the client. Call this script with enough information to watermark the correct image (I'd suggest encrypted a bit) from the "html" that another script generates.
The filename part is unimportant, just a preference, so I won't concentrate on that for now.
Right now, I have the watermarking script on it's own page, so the header content type is not a problem.
Now if I call this script from the text/html page... using include() ? won't it tell me that the header information cannot be modified?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Optionally you could tell php to parse jpg files and rename your script, however I'd advise against this as you don't want php parsing every image file on your host, could:
1) slow down / hinder performance
2) cause problems if php tries to parse something that isn't actually php (unlikely but probably possible)
feyd wrote:you don't call it with include.. you call it like it's an image.. with <img> tags...
<img src="path/to/script.php" alt="pic">
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Nice, I shall give this a try in a bit and see how it turns out. I never knew scripts could be executed inside images tags. Learning rox my sox.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Now, onto the file name. I guess in order to preserve the filename, I'd have to understand what part of the script (in the very first post) makes the picture named 'watermark.jpg' ?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
added note: remember to send a content-length header. You'll need to know this for IE to store the images correctly, otherwise it'll get confused and save them as BMP.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
I don't see how it is getting the original filename of watermark.jpg
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.