Add transparent watermark to image PHP
watermark-photo.jpg is the photo what will be watermarked.
<img src="watermark.php?photo=watermark-photo.jpg" alt="" />
This script creates a new image form the given photo and the watermark. It centers the watermark in front of the background photo. Name the file as watermark.php.
<?php // load the watermark and the photo $watermark = imagecreatefrompng('watermark.png'); $photo = imagecreatefromjpeg($_GET[photo]); // center watermark on the photo $wx = imagesx($photo)/2 - imagesx($watermark)/2; $wy = imagesy($photo)/2 - imagesy($watermark)/2; imagecopy($photo, $watermark, $wx, $wy, 0, 0, imagesx($watermark), imagesy($watermark)); imagejpeg($photo, NULL, 100); ?>
Redirect www to non www with .htaccess RewriteRule
Redirect your websites visitors from www.domain.com to domain.com without www.
Generate Thumbnail on the Fly with PHP
In a previous artice I already showed you how to generate square thumbnails with PHP. Now I show you how to keep the original ratio of the image and how to control the alignment of the square image.
We welcome any comment from you! Please keep in mind that comments are moderated and rel='nofollow' is in use. So, please do not use a domain as your name or a spammy keyword, or your comment will be deleted.