Possibility to filterBy exif()->data() => DateTimeOriginal?

i was wondering if it’s possible to filter my image collection by the built in exif data to display images which are taken between a certain hour of the day.

the same question applies to create some sort of foreach loop to somewhat identify my collection and sort them in several collections to pass a time table such as:

  • 19:00 to 20:00 ( count how many pictures fit this time )
  • 20:00 to 21:00 ( count )
  • 21:00 to 22:00 ( count )

to basically automate the most out of my collection.

You can use the $file->exif() method. Filtering should work with a filter with callback.

I’ve sorted out the list to count for each hour which i solved like this:

<?php foreach($studio->images() as $image): ?>
  <?php if($date = $image->exif()->data()['DateTimeOriginal']): ?>
     <?php $values[] = date('H',strtotime($date)); ?>
   <?php endif ?>
<?php endforeach ?>
<?php foreach(array_count_values($values) as $hours => $value): ?>
<?php echo $hours ?>
<?php echo $value; ?>
<?php endforeach ?>

Just need to work on on the filter to display only between certain hours.

Edit: A few moments later…

  if($zeit = param('zeit')){
    $list = new Collection();
    $i = 0;foreach($page->images() as $image){
        if(date('H',strtotime($image->exif()->data()['DateTimeOriginal'])) == $zeit){
    $list = $list->paginate(50);

that’s working for me to get a certain collection based on the current hour.