- substr: documentation ( source)
- ltrim: documentation ( source)
- var_dump: documentation ( source)
- str_replace: documentation ( source)
- strrpos: documentation ( source)
<?php
$storagedir = '/vagrant/www/resource-space/include/../filestore';
$dir_file_path = '/vagrant/www/resource-space/include/../filestore/2/4/0_ed2583e62f4dc12/240_b69bd79a9431acc.jpeg';
$filename_rootpath = ltrim(str_replace($storagedir, '', $dir_file_path), '/');
$filename = substr($filename_rootpath, (strrpos($filename_rootpath, '/') + 1));var_dump($filename);
$extension = substr($filename, (strrpos($filename, '.') + 1));var_dump($extension);