News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

.Net Magazine:
Create an SVG data visualization with PHP
September 13, 2011 @ 12:13:25

On the .net magazine site (yes, really) there's a recent post from Brian Suda about creating SVG images with PHP thanks to the GD functionality that's included in every release.

If you're working online, then canvas springs to mind. It allows you to draw raster graphics quickly and easily. If you want, there are also plenty of image code libraries that can generate GIFs, JPEGs and PNGs on request. But what if your target isn't always online? What if you're aiming for print? Then you could use a raster graphic, but it would need to be pretty large. A better solution is to create a vector-based image format from your code. This is where SVG (Scalable Vector Graphics) steps in.

He starts by explaining a bit about SVG and what it is for those that haven't worked with it before. He givesn an example of a poster from Wired showing circles with colors from their covers over the last 15 years. He shows how to do something similar with images of the .net magazine covers, pulling out the color frequency with the imagecolorat function. Toss in a bit of markup and some formatting of the color output and you'll get circles with concentric rings with the most prominent colors ending up the largest. You can see his result here.

0 comments voice your opinion now!
svg tutorial gd image color frequency


blog comments powered by Disqus

Similar Posts

Refulz Blog: Yii Framework - Scenarios for Conditional Multiple Validation Rules

John Maver's Blog: How to create a Bebo application using PHP 5

HowToForge: How To Install a Complete LEMP on Ubuntu/Debian

Stefan Mischook's Blog: Aprenda Programacion Orientada a Objetos en PHP

Felix Geisendörfer's Blog: Learning from the CakePHP Source Code (Part 1)


Community Events





Don't see your event here?
Let us know!


interview version symfony composer conference security language voicesoftheelephpant opinion tool community podcast series framework introduction release list laravel library artisanfiles

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework