Het lijkt erop dat er in het vullen en processen van de array iets misgaat, zie alleen niet wat. Het vb. is afgeleid van een post elders op het forum. De complete udt ziet er als volgt uit:
Code: Select all
// Settings
// {foto file="folder/fotonaam.jpg" title="title" side="right | left"}
// Een voorbeeld:
// {foto file="Gallery/Zomer2015/Vakantie 2015/Vakantie 2015 - 52.jpg" title="Helemaal rond" side="left" alt="some text"}
//
// Defaults parameters
//
$smartimage = cms_utils::get_module('CGSmartImage'); // make sure the module is loaded
$cgblog = cms_utils::get_module('CGBlog'); // changed this line.
$gCms = cmsms();
// var_dump($cgblog);
$image_heigth = 170;
$large_size = 640;
$path = 'uploads/images/';
// $path = isset($params['file']) ? $params['file'] : 'uploads/images';
$noremote = '0';
$noembed = '0';
$noresponsive = '1';
$notag = '0';
/* CGBlog article related (string) */
$cgblog_id = isset($params['cgblog_id']) ? $params['cgblog_id'] : '436'; //random number
//
// Get Params
$fotofile = $params['file'];
$path_parts = pathinfo($fotofile);
$fotofile = $path_parts['filename']; // name of the photo from the file-parameter
$fotofile = str_replace(' ','_',$fotofile);
$image_width = isset($params['width']) ? $params['width'] : '120';
$file = isset($params['file']) ? $params['file'] : '';
$title = isset($params['title']) ? $params['title'] : 'Uisge Beatha';
$alt = isset($params['alt']) ? $params['alt'].', '."Uisge Beatha, Zeilen, Watersport" : "Uisge Beatha, Zeilen, Watersport";
$side = isset($params['side']) ? $params['side'] : 'left';
$path_no_spaces = str_replace(' ', '%20', $path);
$pathfile = $path_no_spaces . $params['file'];
$image_no_space = str_replace(' ', '%20', $pathfile);
//
// build an array of params, same as the module accepts
$params = array();
//
$params['src'] = $pathfile;
$params['noresponsive'] = $noresponsive;
$params['notag'] = $notag;
$params['title'] = $title;
$params['noembed'] = $noembed;
$params['width'] = $image_width;
$params['height'] = $image_heigth;
$params['alt'] = $alt;
$params['noremote'] = $noremote;
//
// "params: ".$params|print_r;
// echo "<br/>";
$outp = cgsi_utils::process_image($params);
$image = $outp['output'];
//
$paramshref = array();
$output = array();
$paramshref['src'] = $pathfile;
$paramshref['noresponsive'] = $noresponsive;
$paramshref['noembed'] = 1;
$paramshref['notag'] = 1;
$paramshref['title'] = $title;
$outphref = cgsi_utils::process_image($paramshref); // reduced number of parameters for href
$href = $outphref['output'];
$href=str_replace(' ','%20',$href); // replace spaces in order to validate W3C $pathfile;
echo("<div id=\"$fotofile\" class=\"floatbox_$side floatbox\" data-fb-options=\"group:cgblog-$cgblog_id header:#socialmediashare1 caption:href\">");
echo("<a id=\"a_$fotofile\" data-rel=\"foto_blog\" class=\"floatbox\" href=\"$href\"> $image</a>");
if ($title) {
echo("<span class=\"cgblog_image_title\">$title</span>");
// echo("$bar");
}
echo("<span class=\"cgblog_image_c2e\">(klik voor grote foto)</span>");
echo("</div><p>");