Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Meta.yaml doesn't exist

admin form plugins

Started by Jan Plechtý 5 years ago · 3 replies · 1128 views
5 years ago

I am writing in connection with the metadata of uploaded images.

On a regular page, I have uploaded an image, saved page, and wanted to edit metadata in order to copy this function to my gallery plugin but the popup showed me this message:
doubt.png.meta.yaml doesn't exist

When I checked the directory of the page, it is not really there.

I am using now the latest Grav version: 1.7.18

5 years ago

So I have moved to Grav 1.7.20 but the problem still remains.
But now I know why.

In the Media.php file located at system/src/Grav/Common/Page on line 90

PHP
$exif_reader = isset(Grav::instance()['exif']) ? Grav::instance()['exif']->getReader() : false;

fails and $exif_reader is set to false so

PHP
            // metadata file
            $meta_path = $file_path . '.meta.yaml';

            if (file_exists($meta_path)) {
                $types['meta']['file'] = $meta_path;
            } elseif ($file_path && $exif_reader && $medium->get('mime') === 'image/jpeg' && empty($types['meta']) && $config->get('system.media.auto_metadata_exif')) {
                $meta = $exif_reader->read($file_path);

                if ($meta) {
                    $meta_data = $meta->getData();
                    $meta_trimmed = array_diff_key($meta_data, array_flip($this->standard_exif));
                    if ($meta_trimmed) {
                        if ($locator->isStream($meta_path)) {
                            $file = File::instance($locator->findResource($meta_path, true, true));
                        } else {
                            $file = File::instance($meta_path);
                        }
                        $file->save(Yaml::dump($meta_trimmed));
                        $types['meta']['file'] = $meta_path;
                    }
                }
            }

on line 172 which is

PHP
} elseif ($file_path && $exif_reader && $medium->get('mime') === 'image/jpeg' && empty($types['meta']) && $config->get('system.media.auto_metadata_exif'))

the $exif_reader is set to false so that code is unable to reach the code under the elseif and the yaml file cannot be saved/created.

exif

EXIF Support enabled
Supported EXIF Version 0220
Supported filetypes JPEG, TIFF
Multibyte decoding support using mbstring enabled

I think this is a bug but I don't know how to contact administrators + I think it is only on my machine because it still remains on another subdomain on the same machine.

4 years ago

I just noticed this message in Admin and your question!

So it's not just you. Even though the message means no more than it says, I think it's confusing because it doesn't suggest anything. If you create a metafile next your image, this should go away, but you can't do this in Admin … unless you use the awesome admin-addon-media-metadata plugin!

Sorry I can't help you with automatic EXIF data loading as I have never used it.

👍 1
4 years ago

I'm sorry no-one told you at the time, but it seems you found that Github is the right place for these reports and put it there as well.

Please in future don't cross-post because it wastes members of the community's time. If you need to (as you did, you didn't know!), it's polite to link from one to the other so that no-one wastes time on half of the conversation.

👍 2

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 10 hours ago
General · by pamtbaau, 15 hours ago
1 51 15 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago