Images dynamic naming

In order to improve seo, it is possible to name the images and the path to the images dynamically

We call the method getDynImage of any method of the collector, passing gen parameter of the table of the object in, then the field name of the image that you want to display, and then an array containing the labels that you want to use

For example :


Will display :


Another example :


Will display :



Will display :


Put in the vhost apache :

 RewriteRule ^/dimg2/([^/]*)/([^/]*)/([^/]*)/(.*)$ /dimg2.php?mod=$1&field=$2&id=$3&p=$4 [P] 

Contents of the file controller, in our example dimg2.php:

$mod = (isset($_GET['mod'])) ? $_GET['mod'] : 'products' ; 
$field = (isset($_GET['field'])) ? $_GET['field'] : 'media' ; 
$id = (isset($_GET['id'])) ? $_GET['id'] : "; 

$mod = filter_var($mod,FILTER_SANITIZE_STRING); 
$field = filter_var($field,FILTER_SANITIZE_STRING); 
$id = filter_var($id,FILTER_SANITIZE_NUMBER_INT); 

$file = $_SERVER['DOCUMENT_ROOT'].urldecode($element[$field]); 

$content = file_get_contents($file); 

header('Content-Type: '.image_type_to_mime_type(exif_imagetype($file)));