Jump to content


Photo

Saving watermarks after generated by a form


  • Please log in to reply
2 replies to this topic

#1 sheepo-designs

sheepo-designs
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationWhitby, ON, CAN

Posted 14 April 2006 - 04:28 PM

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:
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);
?>

Thanks again!
[!--coloro:#FF9966--][span style="color:#FF9966"][!--/coloro--]--[!--colorc--][/span][!--/colorc--][!--coloro:#FF6600--][span style="color:#FF6600"][!--/coloro--]sheepo[!--coloro:#000000--][span style="color:#000000"][!--/coloro--].[!--colorc--][/span][!--/colorc--]designs[!--colorc--][/span][!--/colorc--][!--coloro:#FF9966--][span style="color:#FF9966"][!--/coloro--]--[!--colorc--][/span][!--/colorc--]

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 14 April 2006 - 04:39 PM

[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.
Legend has it that reading the manual never killed anyone.
My site

#3 sheepo-designs

sheepo-designs
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationWhitby, ON, CAN

Posted 14 April 2006 - 04:52 PM

No, that wasn't what I was looking for, but thank you for your input.
[!--coloro:#FF9966--][span style="color:#FF9966"][!--/coloro--]--[!--colorc--][/span][!--/colorc--][!--coloro:#FF6600--][span style="color:#FF6600"][!--/coloro--]sheepo[!--coloro:#000000--][span style="color:#000000"][!--/coloro--].[!--colorc--][/span][!--/colorc--]designs[!--colorc--][/span][!--/colorc--][!--coloro:#FF9966--][span style="color:#FF9966"][!--/coloro--]--[!--colorc--][/span][!--/colorc--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users