Hello!
First, I have a snippet:
$content = preg_replace_callback(
'#\(\(image:(\d+)\)\)#i',
function($match) use ($listPict,$baseUrl) {
$p['image'] = $baseUrl.$listPict[$match[1]]['image'];
$p['titre'] = $listPict[$match[1]]['title'];
global $modx;
$chtml = $modx->parseChunk('photoContenu', $p);
return $chtml;
},
$content
);
return $content;
Of course, I didn't put here the entire snippet, just what we need.
Then, my chunk:
<img src="[[!phpthumbof? &input=`[[+image]]` &options=`w=620&h=300&zc=1`]]" alt="[[+titre]]" />
The picture appear but it's
not cropping.
If I change my snippet like this:
$content = preg_replace_callback(
'#\(\(image:(\d+)\)\)#i',
function($match) use ($listPict,$baseUrl) {
$p['image'] = $baseUrl.$listPict[$match[1]]['image'];
$p['titre'] = $listPict[$match[1]]['title'];
$chtml = '<img src="[[!phpthumbof? &input=`'.$p['image'].'` &options=`w=900&h=500&zc=1`]]" alt="'.$p['titre'].'" />';
return $chtml;
},
$content
);
return $content;
The picture appear
and is cropping. But, It's a wrong way. I prefer to use a chunk. I guess you know how much it's better.
So, somebody can help me?