<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 22 May 2013 22:50:29 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Adding Text Watermarks with Imagick]]></title>
      <guid>http://www.phpdeveloper.org/news/18970</guid>
      <link>http://www.phpdeveloper.org/news/18970</link>
      <description><![CDATA[<p>
On PHPMaster.com there's <a href="http://phpmaster.com/adding-text-watermarks-with-imagick/">a recent tutorial</a> from <i> Martin Psinas</i> about how you can add text to an image with the help of Imagick, the image editing software that's available to PHP via an extension.
</p>
<blockquote>
In a previous article, Timothy Boronczyk wrote about how to <a href="http://phpmaster.com/watermarking-images/">create watermarks with Imagick</a> using an overlay image. In this article, I'll show you how to achieve a similar effect using plain text.
</blockquote>
<p>
He takes a sample image (a headshot) and offers two versions of the same functionality - both the shell command (using "convert") and the PHP code that sets up the font to use, adds placement and pushes the result back out as a PNG. He also includes two other types of overlay - a  font mask for a more see-through look and a tiled version, overlaying the text all over the image.
</p>]]></description>
      <pubDate>Mon, 31 Dec 2012 09:15:48 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Nikita Popov's Blog: Supercolliding a PHP array]]></title>
      <guid>http://www.phpdeveloper.org/news/17322</guid>
      <link>http://www.phpdeveloper.org/news/17322</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Nikita Popov</i> talks about a little <a href="http://nikic.github.com/2011/12/28/Supercolliding-a-PHP-array.html">trick with inserting values into arrays</a> that can make it take a lot longer than it should (because of how PHP stores its array values in hashtables).
</p>
<blockquote>
PHP internally uses hashtables to store arrays. The above creates a hashtable with 100% collisions (i.e. all keys will have the same hash). [...] Because every hash function has collisions this C array doesn't actually store the value we want, but a linked list of possible values. [...] Normally there will be only a small number of collisions, so in most cases the linked list will only have one value. But the [included script] creates a hash where all elements collide.
</blockquote>
<p>
He explains why it works, noting that it's relatively simple to do in PHP because of how it applies a table mask. The slowness comes in when PHP is forced to go through the entire list when it tries to insert. Because of this issue, there's the potential for a Denial of Service attack that could potentially take a server down. There's <a href="http://svn.php.net/viewvc?view=revision&revision=321038">a fix already in place</a> for the problem, though, so keep an eye out for the next release (that will include a max_input_vars setting to prevent it).
</p>]]></description>
      <pubDate>Thu, 29 Dec 2011 12:15:30 -0600</pubDate>
    </item>
  </channel>
</rss>
