function getImageData($name, $size) {
$data = get_field($name);
return array_merge($data, [
'thumb' => $data['sizes'][$size],
'width' => $data['sizes'][$size . '-width'],
'height' => $data['sizes'][$size . '-height'],
]);
}
$image = getImageData('lead_image', 'lead-custom-size');
// view.php
<img src="<?= $image['url'] ?>" height="<?= $image['height'] ?>" width="<?= $image['width'] ?>">
git commit -m 'finally got this shit beautified'
// sarcasm begin
// Refactored!
_
_( )_
(_(%)_)
(_)\
| __
|/_/
|
|
$leadimage = get_field('lead_image');
$bot_first_img = get_field('image_#1');
$bot_second_img = get_field('image_#2');
...
// sarcasm end