Jump to content

Saving watermarks after generated by a form


sheepo-designs

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!
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.