Ok, great! What was the problem? How did you solve it?
It does not take much time to edit the image in those cases that you have two aligned child articles. Use one of the predefined image versions (widescreen, cinema or square) and it will only take a couple of seconds…. bad answer I guess ??
I you feel that you must automate the generation of images for child articles you would need to do something like this:
add_filter('arlima_article_image', function($data) {
$img = $data['article']['image_options'];
if( $data['article']['parent'] > -1 ) {
$width = round($data['width'] * 0.5);
switch( $img['size'] ) {
case 'half':
$width = round($width * 0.5);
break;
case 'third':
$width = round($width * 0.33);
break;
case 'fourth':
$width = round($width * 0.25);
break;
}
// height of the image
$height = round($width * 0.5);
// Generate image
// todo: save file in attachment meta!!
$file = get_attached_file($img['attach_id']);
$image_version = image_make_intermediate_size($file, $width, $height, true);
$url = dirname($data['source']) .'/'. $image_version['file'];
// Change image to the one we created
$data['content'] = sprintf(
'<img src="%s" width="%d" height="%d" alt="%s"/>',
$url,
$width,
$height,
$data['article']['title']
);
}
return $data;
});
Note that this code generates the image every time, todo added in code…