topical media & game development
graphic-php-litestamp.php / php
<?php
// NOTE: class is experimental
// Copyright (c) 2006, Simon Jansson <http://www.litewebsite.com> all rights reserved.
// License <http://litewebsite.com/license_BSD.html>
//liteStamp::GDversion();
//
//stamp->stampPicture();
class LiteStamp{
// class variables
private newPictureName = null;
private pictureName = null;
private stampInfo = null;
private stampXpos = null;
private picture, prefix = 'stamp_'){
picture; // original picture to place stamp/watermark on
stamp; // stamp/watermark picture
prefix; // prefix of new stamped picture
}// end of construct
public static function GDversion(){
// GD 2.0.28 or newer is recommended version to use
// http://www.php.net/manual/en/function.gd-info.php
var_dump(gd_info()); // dump information about your GD version
return true;
}// end of GDversion
private function openImage(type){
// open picture with correct image function. Add more types if needed.
// GIF: http://php.net/manual/en/function.imagecreatefromgif.php
// JPG/JPEG: http://php.net/manual/en/function.imagecreatefromjpeg.php
// PNG: http://php.net/manual/en/function.imagecreatefrompng.php
switch (this->fileHandle = imagecreatefromgif(this->fileHandle = imagecreatefromjpeg(this->fileHandle = imagecreatefrompng(fileName);
}
return this->pictureInfo = getimagesize(this->stampInfo = getimagesize(this->pictureFile = this->pictureName, this->stampFile = this->stampName, this->stampXpos = this->stampInfo[0] - 15; // width - width - margin
this->pictureInfo[1] - this->newPictureName = this->pictureName;
// alpha blending: http://php.net/manual/en/function.imagealphablending.php
imagealphablending(this->pictureFile, this->stampXpos, this->stampInfo[0], this->pictureInfo[2]){
case 1: // GIF
imagegif(this->newPictureName);
break;// case 1
case 2:// JPG/JPEG
imagejpeg(this->newPictureName);
break;// case 2
case 3: // PNG
imagepng(this->newPictureName);
break;// case 3
default:
die('Unsupported filetype: '.fileHandle, pictureInfo, prefix, stampName, stampYpos);
}// end of destruct
}// end of class
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.