Jump to content

How to "mark" only one image


ank
 Share

Recommended Posts

Hi everybody,
i am looking for a way to "mark" only one image in a imagesfield with multiple images, so i can request it on the homepage.

I am making a collection of pages with images and on the home page i want to display one image out of every childpage (not the first image of every child)

"I have been thinking on a switch next to the images so that i can "mark" the image, only one image in the imagesfield can be "marked"

 

Any ideas how to archive this ?

 

Link to comment
Share on other sites

  1. Enable tags in your image field
  2. Set predefined tag "homepage".
  3. Get urls of marked images
$pages = wire('pages')->find('myImageField.tags=homepage');
foreach ($pages as $page) {
    echo $page->myImageField->get('tags=homepage')->url;
}

 

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...