fnagel / generic-gallery

TYPO3 extension: Generic Gallery - One gallery to rule them all!
https://extensions.typo3.org/extension/generic_gallery/
GNU General Public License v3.0
7 stars 12 forks source link

Bad Image quality when expanding picture #19

Closed Scunkaneli closed 5 years ago

Scunkaneli commented 6 years ago

Since I updated to TYPO3 8.7.16 LTS from 8.7.13, creating new or modifying old "Default" style gallerys in Mode 2 would cause in a broken image structure. I am sure the "Bootstrap Image Slider" layouts also had the same issues: On the frontend, both the <a class="gallery"> and the <img>, which it contains, shared the exact same image link, which was thumbnail sized and thus very low quality. Using a lightbox on top of this extension or trying to open the picture in full screen would cause the image to look terrible, as the original quality picture was linked nowhere. Previously, the <a href="..."> tag contained a link to the original high quality picture which the lightbox/fullscreen would use, but this was no longer the case.

I was able to fix the problem by editing some Templates and Partials of this extension, but before proposing it to merge with master, I think it would be better to hear if anyone else also experienced the same issue - there is always the possibility that my issue was not caused directly by the TYPO3 update but rather in conjunction with another (incompatible?) extension.

fnagel commented 6 years ago

Sounds like something is broken within your instance. Using pretty much standard Fluid functionality in the default templates. Can you post how your changes look like?

Perhaps updating to a newer TYPO3 version helps (I experienced some issues with 8.7.17).

fnagel commented 6 years ago

Any feedback on this issue?

fnagel commented 6 years ago

Any feedback on this issue?

Scunkaneli commented 6 years ago

Well, the issue still persists on my system. The issue is with <f:link.typolink parameter="{item.link}" class="gallery"> in Partials/GalleryItem/Image.html. This does not output the URL to the original image, but to the processed version of it. You can fix that by replacing it with <a class="gallery" href="fileadmin{item.image.identifier}">

fnagel commented 5 years ago

Still not sure why you having those issues but using href="fileadmin{item.image.identifier}" looks like a very bad idea. What about using item.image.publicUrl?

Did you try to debug the issue within the getLink method in the GalleryItem model?

Scunkaneli commented 5 years ago

I just tried it again. Using <f:link.typolink parameter="{item.link}"> puts the processed (bad) version of the image in the <a href="">. Using <a href="fileadmin{item.image.identifier}"> uses the correct version of the image in the href. I tried your idea with item.image.publicUrl and it works well too; it uses the correct, big original image.

Sadly I have no idea how I should debug it; I did not try that. Of course including fileadmin in the Partial is bad practice but I was happy I got it working at all. As your idea is far better/cleaner and works fine too I now did switch back to using typolink using <f:link.typolink parameter="{item.image.publicUrl}"> Thanks! :)

fnagel commented 5 years ago

That's interesting, as the getLink Method should use image.publicUrl in most cases, see https://github.com/fnagel/generic-gallery/blob/master/Classes/Domain/Model/GalleryItem.php#L164-L179

Would be of great interest to see what the values of some of those properties in the above linked code snippet are. Just add a var_dump and see what happens ;-)

Scunkaneli commented 5 years ago

Where do I have to add var_dump exactly? In GalleryItem.php, Image.html or somewhere different?

fnagel commented 5 years ago

Somewhere in the lines I've linked above. Try something like var_dump($this); but I guess without same basic PHP knowledge this will be a hard task :-/

Scunkaneli commented 5 years ago

Yes, I agree with you on that. I tried adding var_dump($this); and $content=var_export($this,true) echo $content; to L175 of GalleryItem.php, but was not able to find where the result gets displayed or exported to.

fnagel commented 5 years ago

Ahh okay, try the TYPO3 debugger: \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump();

Scunkaneli commented 5 years ago

I added that line to L175 of the same file too but I again can't find a place where something changed. Where should I be able to see the output of the command?

fnagel commented 5 years ago

It should pop-up within the page (on the top). Try placing it before the if, just to test if it's called at all.

Scunkaneli commented 5 years ago

As usually it was my fault why it was not working, sorry. var_dump alone still does not work, but I was able to get output by using \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump();. Sadly I don't think that it did work right: The output was a big list with many entries, but every entry was the same.

fnagel commented 5 years ago

Looks like those are all virtual items, that's why they look similar. Try debug $this->imageReference, they should have different image property values.

And try debugging which return statement is used.

fnagel commented 5 years ago

Any feedback on this issue?

fnagel commented 5 years ago

Closed as no feedback was given. Please reopen or create a new ticket if needed.