Archive for the ‘PHP’ Category

toGDImage() broken: Patching ffmpeg-php 0.6.0

Tagged: PHP, Programming, Ubuntu Date: 8th, February 2009

As fallow-up to previous post (link).

After toying with fresh ffmpeg-php 0.6.0 I kept getting error:
Fatal error: failed to convert frame to gd image

Problem lies in broken function _php_avframe_to_gd_image in ffmpeg_frame.c, in the base ffmpeg-php package.
To fix this problem download this patch file and apply it to ffmpeg_frame.c like so:

cd /path/to/ffmpeg-php-0.6.0/
wget http://hazaah.com/download/ffmpeg_frame.c.patch
patch -p0 ffmpeg_frame.c < ffmpeg_frame.c.patch

Reinstall [...]

  • Leave Comment
  • Read Comments (5)

Ferdinand.PhotoTag – Facebook like photo tagging

Tagged: Ajax, JavaScript, PHP Date: 22nd, December 2008

I have just released very simple photo tagging solution. It works much like Facebook tagging and requires Prototype and optionally PHP5/MySQL (you can always make backend from scratch in any lang/db you wish… it requires novice skills).
Tested in Firefox, IE6+, Safari and Chrome.
Here is the link: http://ferdinand.rs/javascript/ferdinandphototag

  • Leave Comment
  • Read Comments (0)

Simple PHP error handling

Tagged: PHP, Programming Date: 28th, November 2008

Here is a very simple way of custom handling php errors.
To use code below, apart from including it in your functions file, you will need to call function display_debug(); at the end of every page (assuming you wish to display debug on every page).
Nifty feature is that you don’t have to worry about turning off [...]

  • Leave Comment
  • Read Comments (0)

Sort multi dimensional array

Tagged: PHP, Programming Date: 18th, November 2008

/*
* Sort multi dimensional array
*
* @author Vladimir Cvetic < vladimir[ at ]ferdinand.rs >
* @param $a array Array you wish to sort
* @param $index mixed Value of the key by wich you wish to sort
* @param $order string Sort direction
* @param $natsort bool Natural sorting true or false
* [...]

  • Leave Comment
  • Read Comments (0)

Smarty plugin: module

Tagged: PHP, Programming Date: 7th, November 2008

Some time ago I wrote this useful smarty plugin wich will enable you to call method of any php class from smarty html template.
It’s very simple and it goes:

/**
* @author Vladimir Cvetic < vladimir[at]ferdinand.rs >
*/
function smarty_function_module($params, &$smarty)
{
/* Check if required params are valid */
if (!isset($params['class']))
{
$smarty->trigger_error(’Module name is not defined!’);
return false;
}
if (!isset($params['method']))
{
$smarty->trigger_error(’Method name is [...]

  • Leave Comment
  • Read Comments (0)