gerkintrigg Posted June 29, 2007 Share Posted June 29, 2007 Hello. I'm trying to create a script that re-sizes and watermarks images on the fly for a photo library website. I found a free source code system that I have changed slightly and now works at: http://build.nextdaygraphics.com/watermark/index.php but: I need to be able to control the size depending on the use of the image. I need to be able to control whether there is a watermark added or not. I want it to create the image with a watermark (only one... no point in selecting it for this purpose), re-size it, display it and then delete it so that it's not stored on the server. i know that imagedrestroy() will delete it okay, I have a re-size script that works by parsing the full image URL to the script as a variable, but I don't want to do that in-case someone works out the path to the full image from the source code. Then they could get the images for FREE and my clients wouldn't like that too much ;o) Is there something out there that will do all of this for me or do i need to dig into the code a little more and learn this stuff myself? Thanks. Neil Quote Link to comment Share on other sites More sharing options...
micah1701 Posted June 29, 2007 Share Posted June 29, 2007 i think if you are building websites for money, then, per your last sentence, you need to dig in and learn it yourself. that said, here's what I do for an image i create on the fly that gets resized (to a fixed value of 135x170) and adds a drop shadow image (like a water mark, but its behind the image and a little bit bigger): <?php $useFile = "/images/file.jpg"; //location of original. $dropShadowImage = "/images/dropshadow.jpg"; $srcImage = imagecreatefromjpeg($useFile); $srcResize = imagecreatetruecolor(135, 179); imagecopyresampled($srcResize, $srcImage, 0, 0, 0, 0, 135, 179, imagesx($srcImage), imagesy($srcImage)); $dropShadow = imagecreatefromjpeg($dropShadowImage); header('Content-type: image/jpeg'); // tell browser what type of file this is. header('Content-Disposition: inline; filename="copyright_gerkintrigg_2007.jpg"'); // send the file name to the browser. imagecopymerge($dropShadow, $srcResize, 0,0, 0,0, 135, 179, 100); imagejpeg($dropShadow, null, 100); ?> Quote Link to comment Share on other sites More sharing options...
gerkintrigg Posted June 29, 2007 Author Share Posted June 29, 2007 no no, with regard this project. i'm doing it for my own business... I'm getting paid for people using the site, not for designing it as such. But i will spend some time learning the ins and outs. Thanks. Quote Link to comment Share on other sites More sharing options...
gerkintrigg Posted June 29, 2007 Author Share Posted June 29, 2007 That script works perfectly for my purposes. Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.