<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>PHP Thumb: Forum: Plugin Showcase (Unofficial Plugins) - Recent Posts</title>
<link>http://phpthumb.gxdlabs.com/forums/</link>
<description>Help, Suggestions, and General Discussion</description>
<language>en</language>
<pubDate>Tue, 07 Feb 2012 12:14:25 +0000</pubDate>

<item>
<title>Ian on "Rounded Corners plugin (no transparent)"</title>
<link>http://phpthumb.gxdlabs.com/forums/topic/rounded-corners-plugin-no-transparent#post-137</link>
<pubDate>Mon, 16 Nov 2009 19:41:16 +0000</pubDate>
<dc:creator>Ian</dc:creator>
<guid isPermaLink="false">137@http://phpthumb.gxdlabs.com/forums/</guid>
<description>&#60;p&#62;Nice one, if you'd like it included in the distribution, why not fork the project on github, add your code, and send me a pull request (http://github.com/iselby/PHPThumb)?  That way you can keep original credit for the code, etc.&#60;/p&#62;
&#60;p&#62;Otherwise, great work, people can grab it from here!
&#60;/p&#62;</description>
</item>
<item>
<title>leandono on "Rounded Corners plugin (no transparent)"</title>
<link>http://phpthumb.gxdlabs.com/forums/topic/rounded-corners-plugin-no-transparent#post-136</link>
<pubDate>Mon, 16 Nov 2009 17:51:41 +0000</pubDate>
<dc:creator>leandono</dc:creator>
<guid isPermaLink="false">136@http://phpthumb.gxdlabs.com/forums/</guid>
<description>&#60;p&#62;gd_rounded.inc.php&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Code:&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
&#38;lt;?php&#60;br /&#62;
//Based on &#60;a href=&#34;http://911-need-code-help.blogspot.com/2009/05/generate-images-with-round-corners-on.html&#34; rel=&#34;nofollow&#34;&#62;http://911-need-code-help.blogspot.com/2009/05/generate-images-with-round-corners-on.html&#60;/a&#62;&#60;br /&#62;
//(Comments in spanish, sorry!)&#60;/p&#62;
&#60;p&#62;class GdRoundedLib&#60;/p&#62;
&#60;p&#62;	{&#60;br /&#62;
	/**&#60;br /&#62;
	 * Instance of GdThumb passed to this class&#60;br /&#62;
	 *&#60;br /&#62;
	 * @var GdThumb&#60;br /&#62;
	 */&#60;br /&#62;
	protected $parentInstance;&#60;br /&#62;
	protected $currentDimensions;&#60;br /&#62;
	protected $workingImage;&#60;br /&#62;
	protected $newImage;&#60;br /&#62;
	protected $options;&#60;br /&#62;
	public&#60;/p&#62;
&#60;p&#62;	function createRounded($color_rounded = 'FFFFFF', $radio_rounded = 10, &#38;#38;$that)&#60;br /&#62;
		{&#60;/p&#62;
&#60;p&#62;		// bring stuff from the parent class into this class...&#60;/p&#62;
&#60;p&#62;		$this-&#38;gt;parentInstance = $that;&#60;br /&#62;
		$this-&#38;gt;currentDimensions = $this-&#38;gt;parentInstance-&#38;gt;getCurrentDimensions();&#60;br /&#62;
		$this-&#38;gt;workingImage = $this-&#38;gt;parentInstance-&#38;gt;getWorkingImage();&#60;/p&#62;
&#60;p&#62;		// Parametros&#60;/p&#62;
&#60;p&#62;		$this-&#38;gt;color_rounded = $color_rounded;&#60;br /&#62;
		$this-&#38;gt;radio_rounded = $radio_rounded;&#60;br /&#62;
		$canvas_width = $this-&#38;gt;currentDimensions['width'];&#60;br /&#62;
		$canvas_height = $this-&#38;gt;currentDimensions['height'];&#60;/p&#62;
&#60;p&#62;		// Crea una imagen de forma cuadrada&#60;/p&#62;
&#60;p&#62;		$corner_image = imagecreatetruecolor($this-&#38;gt;radio_rounded, $this-&#38;gt;radio_rounded);&#60;/p&#62;
&#60;p&#62;		// Pinta la figura de negro&#60;/p&#62;
&#60;p&#62;		$clear_colour = imagecolorallocate($corner_image, 0, 0, 0);&#60;/p&#62;
&#60;p&#62;		// La pinta del color que seleccionamos&#60;/p&#62;
&#60;p&#62;		$solid_colour = imagecolorallocate($corner_image, hexdec(substr($this-&#38;gt;color_rounded, 0, 2)) , hexdec(substr($this-&#38;gt;color_rounded, 2, 2)) , hexdec(substr($this-&#38;gt;color_rounded, 4, 2)));&#60;/p&#62;
&#60;p&#62;		// Crea la transparencia&#60;/p&#62;
&#60;p&#62;		imagecolortransparent($corner_image, $clear_colour);&#60;br /&#62;
		imagefill($corner_image, 0, 0, $solid_colour);&#60;/p&#62;
&#60;p&#62;		// Crea un eclipse&#60;/p&#62;
&#60;p&#62;		imagefilledellipse($corner_image, $this-&#38;gt;radio_rounded, $this-&#38;gt;radio_rounded, $this-&#38;gt;radio_rounded * 2, $this-&#38;gt;radio_rounded * 2, $clear_colour);&#60;/p&#62;
&#60;p&#62;		// Copia y une la imagen&#60;/p&#62;
&#60;p&#62;		imagecopymerge($this-&#38;gt;workingImage, $corner_image, 0, 0, 0, 0, $this-&#38;gt;radio_rounded, $this-&#38;gt;radio_rounded, 100);&#60;/p&#62;
&#60;p&#62;		// La da vuelta&#60;/p&#62;
&#60;p&#62;		$corner_image = imagerotate($corner_image, 90, 0);&#60;/p&#62;
&#60;p&#62;		// Copia y une la imagen&#60;/p&#62;
&#60;p&#62;		imagecopymerge($this-&#38;gt;workingImage, $corner_image, 0, $canvas_height - $this-&#38;gt;radio_rounded, 0, 0, $this-&#38;gt;radio_rounded, $this-&#38;gt;radio_rounded, 100);&#60;/p&#62;
&#60;p&#62;		// La da vuelta&#60;/p&#62;
&#60;p&#62;		$corner_image = imagerotate($corner_image, 90, 0);&#60;/p&#62;
&#60;p&#62;		// Copia y une la imagen&#60;/p&#62;
&#60;p&#62;		imagecopymerge($this-&#38;gt;workingImage, $corner_image, $canvas_width - $this-&#38;gt;radio_rounded, $canvas_height - $this-&#38;gt;radio_rounded, 0, 0, $this-&#38;gt;radio_rounded, $this-&#38;gt;radio_rounded, 100);&#60;/p&#62;
&#60;p&#62;		// La da vuelta&#60;/p&#62;
&#60;p&#62;		$corner_image = imagerotate($corner_image, 90, 0);&#60;/p&#62;
&#60;p&#62;		// Copia y une la imagen&#60;/p&#62;
&#60;p&#62;		imagecopymerge($this-&#38;gt;workingImage, $corner_image, $canvas_width - $this-&#38;gt;radio_rounded, 0, 0, 0, $this-&#38;gt;radio_rounded, $this-&#38;gt;radio_rounded, 100);&#60;/p&#62;
&#60;p&#62;		imagedestroy( $corner_image );&#60;/p&#62;
&#60;p&#62;		// Devuelve la imagen&#60;/p&#62;
&#60;p&#62;		return $that;&#60;br /&#62;
		}&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;$pt = PhpThumb::getInstance();&#60;br /&#62;
$pt-&#38;gt;registerPlugin('GdRoundedLib', 'gd');&#60;br /&#62;
?&#38;gt;&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;End of code&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Example:&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
&#38;lt;?php&#60;/p&#62;
&#60;p&#62;require_once '../ThumbLib.inc.php';&#60;/p&#62;
&#60;p&#62;$color_rounded = 'E84E00';&#60;br /&#62;
$radio_rounded = 40;&#60;/p&#62;
&#60;p&#62;$thumb = PhpThumbFactory::create('test.jpg');&#60;br /&#62;
$thumb-&#38;gt;adaptiveResize(300, 300)-&#38;gt;createRounded($color_rounded, $radio_rounded);&#60;br /&#62;
$thumb-&#38;gt;show();&#60;/p&#62;
&#60;p&#62;?&#38;gt;&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>leandono on "Rounded Corners plugin (no transparent)"</title>
<link>http://phpthumb.gxdlabs.com/forums/topic/rounded-corners-plugin-no-transparent#post-135</link>
<pubDate>Mon, 16 Nov 2009 17:45:50 +0000</pubDate>
<dc:creator>leandono</dc:creator>
<guid isPermaLink="false">135@http://phpthumb.gxdlabs.com/forums/</guid>
<description>&#60;p&#62;&#60;strong&#62;[Alpha Version]&#60;/strong&#62;&#60;br /&#62;
This plugin create rounded corners. Based on:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://911-need-code-help.blogspot.com/2009/05/generate-images-with-round-corners-on.html&#34;&#62;Apply Rounded Corners to Images On-The-Fly Using PHP and GD Library&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;&#60;blockquote&#62;&#60;br /&#62;
The code generates a mask for the top-right corner by drawing a transparent circle over colored background. This mask is then rotated and superimposed on the specified image four times.&#60;br /&#62;
&#60;/blockquote&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>RB on "watermark plugin"</title>
<link>http://phpthumb.gxdlabs.com/forums/topic/watermark-plugin#post-115</link>
<pubDate>Thu, 01 Oct 2009 20:47:16 +0000</pubDate>
<dc:creator>RB</dc:creator>
<guid isPermaLink="false">115@http://phpthumb.gxdlabs.com/forums/</guid>
<description>&#60;p&#62;&#60;strong&#62;File name&#60;/strong&#62; gd_watermark.inc.php&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#38;lt;?php&#60;/p&#62;
&#60;p&#62;class GdWatermarkLib&#60;br /&#62;
{&#60;br /&#62;
	/**&#60;br /&#62;
	* Instance of GdThumb passed to this class&#60;br /&#62;
	*&#60;br /&#62;
	* @var GdThumb&#60;br /&#62;
	*/&#60;br /&#62;
		protected $parentInstance;&#60;br /&#62;
		protected $currentDimensions;&#60;br /&#62;
		protected $workingImage;&#60;br /&#62;
		protected $newImage;&#60;br /&#62;
		protected $options;&#60;/p&#62;
&#60;p&#62;		public function createWatermark ($mask_file, $mask_position='cc', $mask_padding=0, &#38;#38;$that)&#60;br /&#62;
		{&#60;br /&#62;
			// bring stuff from the parent class into this class...&#60;br /&#62;
			$this-&#38;gt;parentInstance           = $that;&#60;br /&#62;
			$this-&#38;gt;currentDimensions        = $this-&#38;gt;parentInstance-&#38;gt;getCurrentDimensions();&#60;br /&#62;
			$this-&#38;gt;workingImage             = $this-&#38;gt;parentInstance-&#38;gt;getWorkingImage();&#60;br /&#62;
			$this-&#38;gt;newImage                 = $this-&#38;gt;parentInstance-&#38;gt;getOldImage();&#60;br /&#62;
			$this-&#38;gt;options                  = $this-&#38;gt;parentInstance-&#38;gt;getOptions();&#60;/p&#62;
&#60;p&#62;			$this-&#38;gt;mask_file                = $mask_file;&#60;br /&#62;
			$this-&#38;gt;mask_position            = $mask_position;&#60;br /&#62;
			$this-&#38;gt;mask_padding             = $mask_padding;&#60;/p&#62;
&#60;p&#62;			$canvas_width				    = $this-&#38;gt;currentDimensions['width'];&#60;br /&#62;
			$canvas_height				    = $this-&#38;gt;currentDimensions['height'];&#60;/p&#62;
&#60;p&#62;			if ($canvas_width &#38;lt;= 200 &#124;&#124; $canvas_height &#38;lt;= 200) {&#60;br /&#62;
				return $that;&#60;br /&#62;
			}&#60;/p&#62;
&#60;p&#62;			list($stamp_width, $stamp_height, $stamp_type, $stamp_attr) = getimagesize($mask_file);&#60;/p&#62;
&#60;p&#62;			switch ($stamp_type) {&#60;br /&#62;
				case 1:&#60;br /&#62;
					$stamp_image = imagecreatefromgif($mask_file);&#60;br /&#62;
					break;&#60;br /&#62;
				case 2:&#60;br /&#62;
					@ini_set('gd.jpeg_ignore_warning', 1);&#60;br /&#62;
					$stamp_image = imagecreatefromjpeg($mask_file);&#60;br /&#62;
					break;&#60;br /&#62;
				case 3:&#60;br /&#62;
					$stamp_image = imagecreatefrompng($mask_file);&#60;br /&#62;
					break;&#60;br /&#62;
			}&#60;/p&#62;
&#60;p&#62;			imagealphablending($this-&#38;gt;workingImage, true);&#60;/p&#62;
&#60;p&#62;			if ($stamp_width &#38;gt; $canvas_width &#124;&#124; $stamp_height &#38;gt; $canvas_height) {&#60;br /&#62;
				// some simple resize math&#60;br /&#62;
				//$water_resize_factor  = round($canvas_width / $stamp_width);&#60;br /&#62;
				$water_resize_factor  = 0.5;&#60;br /&#62;
				$new_mask_width  = $stamp_width  * $water_resize_factor;&#60;br /&#62;
				$new_mask_height = $stamp_height * $water_resize_factor;&#60;br /&#62;
				$mask_padding    = $mask_padding * $water_resize_factor;&#60;br /&#62;
				// the new watermark creation takes place starting from here&#60;br /&#62;
				$new_mask_image = imagecreatetruecolor($new_mask_width , $new_mask_height);&#60;br /&#62;
				// imagealphablending is important in order to keep, our png image (the watewrmark) transparent&#60;br /&#62;
				imagealphablending($new_mask_image , false);&#60;br /&#62;
				imagecopyresampled(&#60;br /&#62;
					$new_mask_image , $stamp_image, 0, 0, 0, 0,&#60;br /&#62;
					$new_mask_width,  $new_mask_height,&#60;br /&#62;
					$stamp_width,     $stamp_height&#60;br /&#62;
				);&#60;br /&#62;
				// assign the new values to the old variables&#60;br /&#62;
				$stamp_width  = $new_mask_width;&#60;br /&#62;
				$stamp_height = $new_mask_height;&#60;br /&#62;
				$stamp_image   = $new_mask_image;&#60;br /&#62;
			}&#60;/p&#62;
&#60;p&#62;			switch($mask_position) {&#60;br /&#62;
				case 'cc':&#60;br /&#62;
					// Center&#60;br /&#62;
					$start_width 	= 	round(($canvas_width - $stamp_width) / 2);&#60;br /&#62;
					$start_height 	= 	round(($canvas_height - $stamp_height) / 2);&#60;br /&#62;
					break;&#60;br /&#62;
				case 'lt':&#60;br /&#62;
					// Left Top&#60;br /&#62;
					$start_width 	= 	$mask_padding;&#60;br /&#62;
					$start_height 	= 	$mask_padding;&#60;br /&#62;
					break;&#60;br /&#62;
				case 'rt':&#60;br /&#62;
					// Right Top&#60;br /&#62;
					$start_width 	= 	$canvas_width - $mask_padding - $stamp_width;&#60;br /&#62;
					$start_height 	= 	$mask_padding;&#60;br /&#62;
					break;&#60;br /&#62;
				case 'lb':&#60;br /&#62;
					// Left Bottom&#60;br /&#62;
					$start_width 	= 	$mask_padding;&#60;br /&#62;
					$start_height 	= 	$canvas_height - $mask_padding - $stamp_height;&#60;br /&#62;
					break;&#60;br /&#62;
				case 'rb':&#60;br /&#62;
					// Right Bottom&#60;br /&#62;
					$start_width 	= 	$canvas_width - $mask_padding - $stamp_width;&#60;br /&#62;
					$start_height 	= 	$canvas_height - $mask_padding - $stamp_height;&#60;br /&#62;
					break;&#60;br /&#62;
				case 'cb':&#60;br /&#62;
					// Center Bottom&#60;br /&#62;
					$start_width 	= 	round(($canvas_width - $stamp_width) / 2);&#60;br /&#62;
					$start_height 	= 	$canvas_height - $mask_padding - $stamp_height;&#60;br /&#62;
					break;&#60;br /&#62;
			}&#60;/p&#62;
&#60;p&#62;			imagecopy( $this-&#38;gt;workingImage, $stamp_image, $start_width, $start_height, 0, 0, $stamp_width, $stamp_height );&#60;br /&#62;
			imagedestroy( $stamp_image );&#60;/p&#62;
&#60;p&#62;			return $that;&#60;br /&#62;
        }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;$pt = PhpThumb::getInstance();&#60;br /&#62;
$pt-&#38;gt;registerPlugin('GdWatermarkLib', 'gd');&#60;br /&#62;
?&#38;gt;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;//------------------&#60;br /&#62;
$thumb = PhpThumbFactory::create($src);&#60;br /&#62;
$thumb-&#38;gt;adaptiveResize($width, $height);&#60;br /&#62;
$thumb-&#38;gt;createWatermark($mark_image, $position, $padding);&#60;br /&#62;
$thumb-&#38;gt;show();&#60;/p&#62;
&#60;p&#62;//------------------&#60;br /&#62;
$mark_image = 'path/to/mark.png'&#60;br /&#62;
$position =&#60;br /&#62;
&#60;ul&#62;&#60;li&#62;cc = center center&#60;/li&#62;&#60;li&#62;lt = left top&#60;/li&#62;&#60;li&#62;rt = right top&#60;/li&#62;&#60;li&#62;lb = left bottom&#60;/li&#62;&#60;li&#62;rb = right bottom&#60;/li&#62;&#60;li&#62;cb = center bottom&#60;/li&#62;&#60;br /&#62;
&#60;/ul&#62;&#60;br /&#62;
$padding = number like 10 = padding 10px
&#60;/p&#62;</description>
</item>

</channel>
</rss>

