Thursday, 2 October 2014

SPL autoload extensions in PHP

spl autoload extensions in PHP

string spl_autoload_extensions ([ string $file_extensions ] )
Register and return default file extensions for spl_autoload
This function can modify and check the file extensions that the built in __autoload() fallback function spl_autoload() will be using.
<?php
    public function __construct() 
    {
        spl_autoload_register(array($this,'library'));
    }

    public function library($class)
    {
        if (is_string($class) && null === $class) {
            set_include_path(get_include_path().PATH_SEPARATOR.'app/lib/');
            spl_autoload_extension('.php');
            spl_autoload($class);
        }
        return false;
    }
?>

Parse a binary IPTC block into single tags

array iptcparse ( string $iptcblock )

Parse a binary IPTC block into single tags.

Parses an » IPTC block into its single tags.

You might have noticed that several metadata fields in Photoshop are not available via IPTC.



Someone have written a library "PHP JPEG Metadata Toolkit" which fixes this problem as it allows reading, writing and interpreting of virtually any type of metadata, including these missing fields.


Try it out:
http://www.ozhiker.com/electronics/pjmt/index.html



Function Return Value
It return an array using the tagmarker as an index and the value as the value and  returns FALSE on error or if no IPTC data was found.