In a recent post to his blog Sankho Mallik has posted a quick tutorial on using the Zend_Captcha component of the Zend Framework in your forms.
Zend Framework has a set of great classes included to take away a lot of the headaches involved with setting up a CAPTCHA system. The one I use is Zend_Captcha_Image, which creates an image for you and sets up a Session so you will be able to validate all information appropriately. Problem is, there's little documentation out there on this. [...] I'll show you everything you need to know to use Zend_Captcha_Image WITHOUT Zend_Form! If you'd like to learn the implementation using Zend_Form, please visit Robert Basic's Blog.
He follows the steps you'll need to get the component set up - checking for GD installation, making the CAPTCHA image folder - and includes some sample code in the form of a generateCaptcha and validateCaptcha methods to make it all work.
On the PHPBuilder.com site today there's a new tutorial talking about using PHP to dynamically create SVG images in a simple application.
As with many of the pages on my Web site, my SVG images are in fact generated by PHP scripts. I end up including many of the same images in other pages, but not always with the same size or colors, so making them customizable on a case-by-case basis is a useful thing. Attributes such as size, scale, colour, rotation, and position are obtained from arguments in the URL.
His example creates a SVG image using a class (UIControl) to create the content for the image. This content is dropped into the typical XML structure to display it. He also includes some extra attributes/methods you can use with the UIControl class to alter the resulting image.
Let's take a look at 10 useful, yet rather unknown RSS-tricks for WordPress. Each section of the article presents a problem, suggests a solution and provides you with an explanation of the solution, so that you can not just solve some of your RSS-related problems but also understand what you are actually doing.
Vinu Thomaspoints out a nice looking PHP charting library on his blog today - pChart.
Looking for some good looking graphs without having to pay for a library or resort to Flash graphs? Try creating your own using pChart. pChart is a PHP class oriented framework designed to create aliased charts. This project focuses on allowing developers to generate great looking graphs by increasing rendering quality introducing an aliasing algorithm.
It uses GD to create the graphs, so just about any PHP distribution out there will support it (if you're not sure, make a phpinfo() page to check out your setup). There's even some example graphs so you can get an idea of what some of the end results could be.
Brett send in a link to a new post on his "Mr PHP" blog about a method he's come up with to cache images using the phpThumb library.
Generate thumbs by visiting a URL such as your.com/thumbs/images/image.50x50.jpg. This will create a 50x50px thumbnail of your.com/images/image.jpg. The thumb will be stored on your server at your.com/thumbs/images/image.50x50.jpg so the next request for the same image will be loaded without loading php for ultra fast image cache.
The phpThumb tool lets you dynamically resize an image and, if one does not exist for it, make a thumbnail that's output and cached. From then on the script just pulls from that local copy. He includes his code to get it working and the mod_rewrite rule that maps an image request back to it (so it's still "/images/myimage.jpg" instead of "/app/phpThumb.php?src=myimage.jpg&w=100&h=100" in the img src).
Asvin Balloo has posted a tutorial that shows how to combine the YUI libraries with PHP to create a simple image cropper.
This post will show you how to build an AJAX crop image tool using the image cropper control from YUI library and PHP. The ImageCropper Control from the YUI library gives you an interactive interface for getting the dimensions to crop an image and using these dimensions in PHP, we can do some cropping.
The script takes in an upload, shows it in the browser for cropping and once altered, pushes the altered image back out as a download. Full code is included as well as a demo of the final result and a sample file to get you started.
The Web Development Blog has a recent tutorial posted talking about a free option for the TinyMCE tool to work with uploading images.
TinyMCE is a great online WYSIWYG editor which is used for a lot of projects, for example this Wordpress blog application (the content backend). [...] Sometimes the Image manager too looks too big for some projects and than is the following (free) solution an option. You can download your copy from the TinyMCE website.
He shows how to include the plugin (so the resulting TinyMCE instance can include it) and the PHP code to do the handling for the upload, based on this upload class. The end result is a simple, integrated feature that lets you upload a few different kinds of images.
In this recent post to the Ajaxray blog Anis Ahmad shows how to use the PHP Thumbnailer class inside of a Zend Framework application.
In the huge set of library, Zend Framework have no options for manipulating image. There is a proposal for Zend_Image which aimed to provides easier image manipulation using GD. But the proposal was not considered. [...] So, what to do when we need to make image thumbnail, resizeing or cropping image etc in Zend Framework?
He shows how to integrate the Thumbnailer class with the Framework - making it a library and implementing it within a controller (a private function called _createThumbnail).
The ProDevTips blog has posted the fifth part of their look at using Doctrine with PHP. This time they focus on file uploads.
It's time to take a look at how file uploads can be integrated into the Doctrine validation and CRUD process. We will have a product in the form of a digital download as an example, it will have a screenshot image that can be maximum 250 pixels wide and high. The download itself will be a zipped file.
They set up their table definitions first and set up a few validation functions (update, insert and for the file data) to work on top of that. Custom upload/uploadImage and save methods handle the user's submission while a simple delete method makes removing images easy.
Recently, Cormac posted this look at a method for lazy loading on variables in an object with the magic __get method.
I used the magic method __get() to load the images into the [Product] object when they were needed. __get() is called whenever something tries to access a variable that is not set or publically accessible, so basically I used that to load the images whenever some other piece of code tried to access Product::images.
He includes a quick bit of code that fires off an internal private method for the class that loads up the images. In his example, if they're already loaded, it never gets called.