This may have been posted within the old forum. In the Languages section of the Kirby Docs, I noticed that there was a section discussing the translation of file meta information. In it there was example with a file, myimage.jpg, having accompanying meta files such as myimage.jpg.en.txt ect.
The meta information I want to add to these txt files are not something you could find using $exif as they are custom graphics I’m exporting out of Illustrator. I would like to add to these meta files, such as myimage.jpg.en.txt, info such as author, copyright, liciencing, caption ect.
Can these meta files be produced within the panel or do I have to add them manually to its respective folder in /content? If this can’t be done, is there a plugin fo this. If not, is this something that would be worthy of a plugin?
The metadata files can be created via the panel. All you need to do is define the fields you need in the blueprint, for example:
<?php if(!defined('KIRBY')) exit ?>
title: Project Page
pages: true
files: true
fields:
author:
label: Author
type: text
copyright:
label: Copyright
type: text
caption:
label: Caption
type: textarea
fields:
title:
label: Titel
type: text
Then once you have uploaded a file and click on it in the sidebar of the panel, the “image editor” is opened and you can add the information for each file.
This was also a huge help for me. Thank you ! I have the Image Meta Information addedin the CMS Panel.
But, how I can enquiries the Image Meta Information with <php echo ... ?>
Sorry for my bad englisch !
// Deutsch
Danke für die Hilfe ! Die Meta Informationen für jedes einzelne Bild habe ich bereits im Panel hinzugefügt. Wie kann ich nun diese mit php echo abfragen ? ich möchte das mit einer schleife machen.
Just replace with your metadata field names … Then add ->html() or ->kirbytext() methods depending on the type of field …
BTW. If your folder contains other files that images, you may want to limit your call to images, i.e. instead of using $page->files() use $page->images() …
Yes, the fields have to be added to each individual blueprint. You can use global field definitions, so that there’s less code in each file.
@thguenther I my opinion it doesn’t make sense to add the same alt attribute to all images, since it doesn’t add any additional value, it would be better to leave the value empty, if not meta data exists?
@texnixe I think I didn’t understand the question correctly. I thought about using an alt tag for all images, not all blueprints.
But if I remember correctly, an alt tag should not be empty. Not sure how this affects the ranking or anything, but I sometimes provide the website or page title as the fallback. That might not be ideal, though.
I want to add an alt tag to all images, as explained above, but instead of changing every blueprint to add the alt tag, I wanted to know whether or not I can define one globally
No, from what I have read regarding accessibility and screen readers etc. it doesn’t make sense to add a value to an image if it is purely decorational for example, or if the value doesn’t add any value. In such cases, it is better to leave the alt attribute empty (not remove it completely, though).