Multiple image sizes within the same foreach loop?
-
I love this plugin. I use it with almost every project – but I’m always running into issues handling images.
I’ve got a project where I’m using image_advanced for users to populate a jquery slider on the front end. Each uploaded image shows up as a slider image (large) and an thumbnail (thumbnail).
Can I pull values for both sizes from a single array? Or is there a comprehensive way of merging the large array with the thumbnail array?
The following code is not valid, but it might help show what I’m going for.
$images = rwmb_meta( 'savino_gallery', 'type=image&size=large' ); $thumbs = rwmb_meta( 'savino_gallery', 'type=image&size=thumbnail' ); foreach ($images as $image && $thumbs as $thumb) { echo "<li data-thumb='{$thumb['url']}'><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></li>"; }
This may just be a matter of tweaking php syntax, but I’m not sure where to go from here.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Multiple image sizes within the same foreach loop?’ is closed to new replies.