fabianmichael/kirby-imagekit

Allow caption from file metadata

jklue opened this issue · 0 comments

jklue commented

I had my own custom image kirby tag which used the caption from the image metadata as the caption. Is there a way I can modify this plugin to allow that as well, instead of requiring me to write (image: image1.jpg caption: This is my caption)?

Here's my project page blueprint which allows captions for images in their metadata:

title: Project
pages: false
files:
    fields:
        caption:
            label: Caption
            type: textarea

Thanks in advance!

EDIT: Maybe this is a question for kirby-imageset instead (I'm using these two plugins together).

EDIT2: FWIW, I found the site/plugins/imageset/tags/image.php file in the kirby-imageset plugin and added the following at line 66 to try and set the caption.

    // try to get the caption from file metadata
    if($file) {
        if(empty($caption) and '' != $file->caption()) {
            $caption = $file->caption();
        }
    }

All works now! You can close this, thanks.