Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: Auto metadata from Exif: throwing error when switched on #2248

Closed
MattAppleton opened this issue Nov 1, 2018 · 25 comments
Closed

config: Auto metadata from Exif: throwing error when switched on #2248

MattAppleton opened this issue Nov 1, 2018 · 25 comments

Comments

@MattAppleton
Copy link
Contributor

MattAppleton commented Nov 1, 2018

This error has been tested on a completely vanilla / untouched install of Grav v1.5.3 - Admin v1.8.12

If we add an image WITH a metadata description / creator / keyword using the admin in 'normal' mode it throws an error like this, and the image doesn't appear to view...

Opening file for writing failed on error fopen(user://...@2x.jpg.meta.yaml): failed to open stream: "\RocketTheme\Toolbox\StreamWrapper\ReadOnlyStream::stream_open" call failed

adding a keyword-less file is fine and doesn’t prompt errors if added to a page…! Seems like a bug or am I being daft?!

if we click out of the page and back in in 'expert' mode (not 'normal' mode) the page does seem to behave OK though...

screen shot 2018-11-01 at 20 05 59

@MattAppleton MattAppleton changed the title config: Auto metadata from Exif: ON throwing error config: Auto metadata from Exif: throwing error when switched on Nov 1, 2018
@rhukster
Copy link
Member

rhukster commented Nov 3, 2018

I will look into this.

@rhukster rhukster self-assigned this Nov 3, 2018
@rhukster
Copy link
Member

rhukster commented Nov 3, 2018

Can you please upload an image (or email me one) that is causing the issue. I just tested a sample image and it worked.

NOTE: You have to 'save' the page first before the metadata file is created.

image 2018-11-03 at 2 47 44 pm

original:

canon_digital_ixus_400

@rhukster
Copy link
Member

rhukster commented Nov 3, 2018

Also works for me if i append @2x for a retina image.

@MattAppleton
Copy link
Contributor Author

Will do, just firing up my testbed so I can check exactly what was throwing the error.

@MattAppleton
Copy link
Contributor Author

johnspinks_ble0427g_05 2x

@MattAppleton
Copy link
Contributor Author

this image has 'landscape' in the keyword IPTC core metadata

@MattAppleton
Copy link
Contributor Author

If I add it via the admin to GRAV I get various error screens like this...

screen shot 2018-11-03 at 22 05 57

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Nov 3, 2018

There problem occurs when I hit 'save', then the red error screen persists. I am able to see that the file has been ingested looking at the .md file, but the 'normal' admin view > page media field shows no image content at all. And no metadata.yaml feel is added to the relevant folder.

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Nov 3, 2018 via email

@rhukster
Copy link
Member

rhukster commented Nov 4, 2018

I tried your image above, and uploaded and saved just fine: Created a yaml file with:

Orientation: 1
ColorSpace: 65535
keywords: landscape

@rhukster
Copy link
Member

rhukster commented Nov 4, 2018

image 2018-11-03 at 6 26 12 pm

I'm not sure what you are doing differently from me. I'm running on PHP 7.2 with exif enabled in PHP config:

image 2018-11-03 at 6 27 03 pm

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Nov 4, 2018 via email

@MattAppleton
Copy link
Contributor Author

OK, so trying to unpick this further...

On a Linode / Serverpilot box running
Grav v1.6.0-beta.4 - Admin v1.9.0-beta.4 (fresh install this evening)
PHP Version 7.2.11
EXIF Version | 7.2.11

I get the aforementioned errors when operating via the Admin plugin interface (ie adding images via admin interface) - - this is ONE exampel of the error message panels thrown, the other wont let me copy/paste
"Opening file for writing failed on error fopen(user://...@2x.jpg.meta.yaml): failed to open stream: "\RocketTheme\Toolbox\StreamWrapper\ReadOnlyStream::stream_open" call failed

on an older install
on SAME Linode Serverpilot box running
Grav v1.4.0-rc.1 - Admin v1.7.0-rc.2
PHP Version 7.2.11
EXIF Version 7.2.11
I DONT get these errors... ?!

install 1 (exif problems, seem to bit intermittent after a break though, ie if I come back later I can 'see' the image in the admin):
https://private.modernactivity.com/GRAV/

install #2 (no problems
https://sandbox.modernactivity.com/grav-admin_Feb_base/

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Nov 6, 2018

Had a moment to check in on this again. If I revisit the site admin on install #1 (https://private.modernactivity.com/GRAV/) on a different machine ./ new session, I do NOT get an error in admin view, I can see the image in the relevant post/.page.

BUT if I try adding a new image to a new page I get the same issue, red error opens and an 'invisible' image that has beed added to the site, but not been recognized by the admin, with no meta.yaml generated...

screen shot 2018-11-06 at 20 55 10

screen shot 2018-11-06 at 20 55 27

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Nov 6, 2018

If I then clear cache / refresh and revisit the page in admin, it does work. Interestingly, it is only at that point that the meta.yaml is generated, so some time AFTER the image is added... basically the meta.yaml only seems to be generated on the second 'fresh' admin page visit.

screen shot 2018-11-06 at 21 01 29

screen shot 2018-11-06 at 21 02 36

@rhukster
Copy link
Member

rhukster commented Nov 6, 2018

ok that's useful information that should help me diagnose the issue... thanks.

@MattAppleton
Copy link
Contributor Author

thanks for looking at this...

just ran latest Quark update on install #1, issue still live tho'

@MattAppleton
Copy link
Contributor Author

Hi there — perhaps this is something being looked at with GRAV 2, but just wanted to say that the latest stable GRAV / Admin plugin / Quark still gives us the issue (red panel, disappearing images in admin) when eddying images with IPTC metadata.

And trying the same procedure with

Grav v1.6.0-beta.6 - Admin v1.9.0-beta.6 - latest beta Quark - - same issue when adding images with embedded metadata...

@MattAppleton
Copy link
Contributor Author

Hullo

I am still getting the same 'red panel on upload' errors when trying to add an image with keyword metadata: https://private.modernactivity.com/GRAV/test-pic_tues_02

As before, clearing cache and refreshing seems to help. But the issue is driving clients mad, as they want to keep using caption functions that express caption info held on the image file itself!

untouched plain install of Grav v1.6.0-rc.3 - Admin v1.9.0-rc.3

@MattAppleton
Copy link
Contributor Author

the 'stable' install does NOT encounter the issue still
Grav v1.4.0-rc.1 - Admin v1.7.0-rc.2

BUT when going to
Grav v1.5.8 - Admin v1.8.19

Image error panel appears when uploading keyword-tagged image.

@rhukster
Copy link
Member

Ok, try this, around line 174 in system/src/Grav/Common/Page/Media.php, replace the existing if statement with this

                    if ($meta_trimmed) {
                        $full_meta_path = Grav::instance()['locator']->findResource($meta_path, true, true);
                        $file = File::instance($full_meta_path);
                        $file->save(Yaml::dump($meta_trimmed));
                        $types['meta']['file'] = $meta_path;
                    }

@MattAppleton
Copy link
Contributor Author

@rhukster — Amazing work Andy, thus far it has solved exif-related media upload issues on my testbed install, will try it on a few other instances...

@MattAppleton
Copy link
Contributor Author

just to say - -my recent testing checks out well, I think this issue solved, great work with current v1.6!

@rhukster
Copy link
Member

Phew, saw this come in and thought it was a new issue!

@bricebou
Copy link

Hi,

It finally works both on localhost and on a shared hosting... But I don't know it it's the change of the if statement mentioned below or anything else...
And there are several unknown causes :

  • definitely an issue with cache : I have to clear the cache for the exif metadata to be accessible ;
  • it seems I can't make exif auto metadata alongside with the Admin Addon Media Rename.

I'm using the latest stable Grav + Admin plugin package, on a local Debian Buster ; all requirements are "green" in the Tools > Reports page.

By the way, it seems that the conversion from coordinates in degrees to decimal values are quite buggy...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants