flokosiol / kirby-focus

Better image cropping for Kirby CMS
184 stars 14 forks source link

[Question] multiple focus fields #67

Closed hansgohr closed 2 years ago

hansgohr commented 2 years ago

I was trying to make use of your plugin to provide "info areas" on images, with some tooltip text. However once I have multiple focus fields in the file blueprint, or they're named other than "focus" (i.e. focusA, focusB) it won't work anymore. Do you maybe have a quick solution for this or would this be something bigger? :) Thank you already!!

i.e. like this:

fields:
  focusPoints:
    label: FocusPoints
    type: structure
    fields:
      focus:
        label: Point
        type: focus
        width: 1/2
      text:
        label: Tooltip
        type: textarea
        width: 1/2
<?php
    $items = $image->focusPoints()->toStructure();
    foreach ($items as $item): ?>
      <?php
        $x = $item->focusPercentageX();
        $y = $item->focusPercentageY();
       ?>
      <button style="top: <?= $y ?>%; left: <?= $x ?>%"></button>
<?php endforeach ?>

( I also tried it without a structure, won't work either)

flokosiol commented 2 years ago

I'm sorry, but there will be no quick fix. The main purpose of the focus plugin is to provide one single point of an image.

Please check out the amazing https://github.com/sylvainjule/kirby-annotator plugin by @sylvainjule. This might be the thing you're looking for – if I got you right.

hansgohr commented 2 years ago

completely forget about this one, thank you!