News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Gonzalo Ayuso's Blog:
Watermarks in our images with PHP and mod_rewrite
March 01, 2011 @ 08:36:21

Gonzalo Ayuso has a new tutorial posted to his site today showing how to use mod_rewrite and a little bit of PHP magic to watermark images without having to apply it to each one manually.

he idea is simple. Instead of opening directly the image, we are going to open a PHP script. This PHP script will open the original image file with imagecreatefromjpeg, add the footer and flush the new image to the browser with the properly headers.

Since it would be a lot of trouble (especially on a larger site) to have to rewrite all of the <img> tags to point to this new PHP script for adding the watermark, he opts for the .htaccess instead. It catches and rewrites the request to the "watermark.php" file which pulls in that image, watermarks it and pushes the result back out.

0 comments voice your opinion now!
watermark tutorial imagecreatefromjpeg image dynamic


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Build Blazing Fast PHP Websites with Memcached Distributed Caching

Community News: Sara Golemon & Christopher Jones - First Day Summaries of php|works

SitePoint PHP Blog: Build Virtual Machines Easily with PuPHPet Part 2

Devshed: The Basics of Using the Prototype Pattern with PHP 5

IBM developerWorks: Understanding the Zend Framework,Part 4: When there is no feed, Zend_HTTP_Client


Community Events

Don't see your event here?
Let us know!


version podcast api language library php7 extension introduction opinion conference interview framework series release example laravel5 community unittest voicesoftheelephpant laravel

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework