Validating Image Uploads in CakePHP

16th June, 2008 – 10:17 pm

Following on from my article on CakePHP – Uploaded File Validation in Models, today’s snippet will show you how to use Cake’s validation rules to reject invalid images, or images which do not conform to a specified mime-type. This code relies on the fact that you have LibGD installed on your webserver.

<?php
Class Image extends [...]

Continue reading Validating Image Uploads in CakePHP

Holiday Photography

15th June, 2008 – 9:20 am

I’m back from a week long holiday in the bay of Elounda, Crete. During my stay I took about 200 pictures using my trusty Samsung i6 my favourite of which were taken on the Island of Spinalonga which served as a leprosy colony until 1957, the following pic was snapped looking back towards Plaka.

The [...]

Continue reading Holiday Photography

CakePHP – Activating User Account via Email

3rd June, 2008 – 10:11 pm

Continuing on from my User Registration with the AuthComponent post I’m going to cover how to activate user account’s via email. Before we get down to the code lets look at a simple use case first.
Activating User Accounts Via Email Use Case
Goal: To confirm that users are registering with a valid email address, force [...]

Continue reading CakePHP – Activating User Account via Email

CakePHP – Open_Basedir Restriction in Effect

2nd June, 2008 – 10:37 pm

Just deployed a CakePHP on a domain running PLESK and dismayed by the fact that your screen is over-flowing with warning about open_basedir restriction in effect? Fear not, the solution is straight forward (if a little frustrating to track down!)
The problem is caused by this line (line 69, in CakePHP 1.2.0.6311) in /app/webroot/index.php:

ini_set(‘include_path’, CAKE_CORE_INCLUDE_PATH [...]

Continue reading CakePHP – Open_Basedir Restriction in Effect

ActionScript 2.0 Configuration Class

2nd June, 2008 – 2:19 pm

This is an update to my original Actionscript 2.0 Configuration Class which I wrote back in February. It features a new access method for reading and writing values and allows you to load in external XML configuration documents with an easy to understand Schema. All comments welcome.

Continue reading ActionScript 2.0 Configuration Class

CakePHP – Uploaded File Validation in Models

1st June, 2008 – 3:56 pm

Allowing uploaded files from users in PHP is fraught with danger, however by using CakePHP 1.2 and a little bit of Validation magic we can make things a little safer.
First, lets start by creating a simple upload form where the users will be uploading their files

<?php
# /app/views/story/create.ctp
echo $form->create(‘Story’, array(‘action’ => ‘create’, ‘type’ => ‘file’));
echo $form->input(‘Story.title’);
echo [...]

Continue reading CakePHP – Uploaded File Validation in Models

CakePHP, Using CounterCache to keep track of Comments

31st May, 2008 – 7:59 pm

CounterCache is one of the new Core Model Behaviors in CakePHP 1.2 and it’s an absolute life saver for working with hasMany relationships where you want to OrderBy one of the children.
The basic idea behind a CounterCache is to keep tabs on how ‘children’ a specific model has, this is best explained in a quick [...]

Continue reading CakePHP, Using CounterCache to keep track of Comments

CakePHP Vimeo Helper

26th May, 2008 – 10:37 am

I’ve just posted a new Helper over at the bakery to assist with embedding Vidoes from Vimeo.com on your CakePHP site. The helper grants you access to all configuration flags for the player. Grab it here, happy baking!
As a side note, whilst fiddling around with this helper I found it interesting to note [...]

Continue reading CakePHP Vimeo Helper

User Registration with CakePHP 1.2 and Auth Component

24th May, 2008 – 11:54 am

With CakePHP 1.2 nearly reaching the RC release, I have started using it as the framework for my own applications.  Once of the new features of 1.2 over 1.1 is the addition of numerous core Components for handling things such as Cookies, Email and Authentication (all of which I rolled myself in 1.1).  Today’s article [...]

Continue reading User Registration with CakePHP 1.2 and Auth Component

Flare – Actionscript 2.0 SWF Decompiler

12th February, 2008 – 11:15 am

Flare is a free (as in beer) Actionscript 2.0 decompiler with GUI clients for Windows and Mac (and CLI for Windows, Mac and Linux).  I just had a quick play with it to examine a 3rd party component (swc file) and was suprised by the readability of the output; running it on my on .swf [...]

Continue reading Flare – Actionscript 2.0 SWF Decompiler