<?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 Topic: Rounded Corners plugin (no transparent)</title>
<link>http://phpthumb.gxdlabs.com/forums/</link>
<description>Help, Suggestions, and General Discussion</description>
<language>en</language>
<pubDate>Thu, 09 Sep 2010 04:34:55 +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>

</channel>
</rss>
