Meta.yaml doesn't exist

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

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

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

fails and $exif_reader is set to false so

            // 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

} 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.

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.

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.

1 Like