Jump to content

Archived

This topic is now archived and is closed to further replies.

sheepo-designs

Saving watermarks after generated by a form

Recommended Posts

I have made a system where either myself or my collegues can post news headlines from a password protected form. We were wondering if we could make the news page more attractive, so I decided to use watermarking to generate more attractive titles for the news. I'm having a problem with saving each watermark afters its made, though. If its possible I'd like to save them all in a directory called "headlines" and call them back on the home page where the news is displayed ( might need a little help with that, too). Thanks!

Here's code I'm using:
[code]
Here's the HTML on a seperate page:
<form method="get" action="watermark.php"> <input type="text" name="input"> <input type="submit" value="send"> </form>

Here's the PHP:
<?php
// Set the enviroment variable for GD
putenv('GDFONTPATH=' . realpath('.'));

// Name the font to be used (note the lack of the .ttf extension)
$font = 'Excellentia';

//text string
$text = $_GET["input"];

//type
header("Content-type: image/png");

//create new blank image for the bg (or you can create from another image)
$im = imagecreate(500, 200);

//make colors
$tan = imagecolorallocate($im, 139, 109, 65);

//imagettftext ( resource image, float size(font size), float angle(keep @ zero), int x, int y, int color, string fontfile, string text )
imagettftext($im, 30, 0, 40, 30, $tan, $font, $text);

//output to browser and SAVE FILE
imagepng($im,"watermark.png");

//destroy image
imagedestroy($im);
?> [/code]

Thanks again!

Share this post


Link to post
Share on other sites
[a href=\"http://www.design-ireland.net/index.php?http%3A//www.design-ireland.net/graphics/imagery-16.php\" target=\"_blank\"]http://www.design-ireland.net/index.php?ht.../imagery-16.php[/a] has a discussion about server-side image caching which might help.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.