protected function getFileParts($filename)
    {
        if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) {
            $name = $matches[1];
            $extension = $matches[3];
            $extra = (int) $matches[2];
            $type = 'alternative';

            if ($extra === 1) {
                $type = 'base';
                $extra = null;
            }
        } else {
            $fileParts = explode('.', $filename);

            $name = array_shift($fileParts);
            $extension = null;
            $extra = null;
            $type = 'base';

            while (($part = array_shift($fileParts)) !== null) {
                if ($part !== 'meta' && $part !== 'thumb') {
                    if (null !== $extension) {
                        $name .= '.' . $extension;
                    }
                    $extension = $part;
                } else {
                    $type = $part;
                    $extra = '.' . $part . '.' . implode('.', $fileParts);
                    break;
                }
            }
        }

        return array($name, $extension, $type, $extra);
    }
protected function getFileParts($filename)
    {
        if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) {
            $name = $matches[1];
            $extension = $matches[3];
            $extra = (int) $matches[2];
            $type = 'alternative';

            if ($extra === 1) {
                $type = 'base';
                $extra = null;
            }
        } else {
            $fileParts = explode('.', $filename);

            $name = array_shift($fileParts);
            $extension = null;
            $extra = null;
            $type = 'base';

            while (($part = array_shift($fileParts)) !== null) {
                if ($part !== 'meta' && $part !== 'thumb') {
                    if (null !== $extension) {
                        $name .= '.' . $extension;
                    }
                    $extension = $part;
                } else {
                    $type = $part;
                    $extra = '.' . $part . '.' . implode('.', $fileParts);
                    break;
                }
            }
        }

        return array($name, $extension, $type, $extra);
    }
protected function getFileParts ( $ filename ) { if ( preg_match ( '/(.*)@(\d+)x\.(.*)$/' , $ filename , $ matches ) ) { $ name = $ matches [ 1 ] ; $ extension = $ matches [ 3 ] ; $ extra = ( int ) $ matches [ 2 ] ; $ type = 'alternative' ; if ( $ extra === 1 ) { $ type = 'base' ; $ extra = null ; } } else { $ fileParts = explode ( '.' , $ filename ) ; $ name = array_shift ( $ fileParts ) ; $ extension = null ; $ extra = null ; $ type = 'base' ; while ( ( $ part = array_shift ( $ fileParts ) ) !== null ) { if ( $ part !== 'meta' && $ part !== 'thumb' ) { if ( null !== $ extension ) { $ name .= '.' . $ extension ; } $ extension = $ part ; } else { $ type = $ part ; $ extra = '.' . $ part . '.' . implode ( '.' , $ fileParts ) ; break ; } } } return array ( $ name , $ extension , $ type , $ extra ) ; }
Get filename, extension and meta part.

@param  string $filename
@return array
Get filename extension and meta part .