Version: (using KDE 4.3.4) OS: Linux Installed from: Ubuntu Packages I have a set of pictures where extension is jpeg, but I found out that content type is actually png. With such file, kde does not build the preview image you can normally see in konqueror details view with preview activated obviously. Renaming to .png fixes the problem. I know those file should have the extension .png, but still I think KDE should not rely on file extension to create the preview or not, which it does if my understanding of the issue is good.
Reassigned to dolphin.
This is probably a Qt bug. See bug 182361 for more information.
*** Bug 247964 has been marked as a duplicate of this bug. ***
Resetting assignee to default as per bug #305719
*** Bug 316804 has been marked as a duplicate of this bug. ***
IMHO, it makes no sense that every application (Gwenview, Dolphin, the file dialog, Folder View, etc.) finds its own workaround for this issue. I'm not exactly sure what the root cause is, but KIO::PreviewJob or the thumbnailing code in kde-runtime look like places where this could be fixed in a way such that every KDE application benefits from it.
Confirmed. Although in KDE 4.10.0 this was fixed for Gwenview (and now it's able to open files with swapped extensions) it wasn't fixed for the thumbnail generator too like I imagined it automatically would.
*** Bug 325367 has been marked as a duplicate of this bug. ***
I can't believe this trivial-looking bug survived 4 years and 7 KDE releases.
(In reply to comment #9) > I can't believe this trivial-looking bug survived 4 years and 7 KDE releases. Unfortunately, the number of people who invest their spare time into triaging and fixing KDE bugs is far too low to cope with the huge number of bug reports. We would very much appreciate your help - if you believe that this one is simple to fix, please dig into the source and submit a patch to https://git.reviewboard.kde.org/ Thanks for your help!
Wow, it survived another 3 years!
Confirming this still exists with Plasma 5.6.4, Dolphin 16.04.1 (latest openSUSE Tumbleweed packages). As much as I understand the limited workforce of free and open-source software, things like this going unfixed for years are what saddens and worries me about KDE.
Now I found this again, and I had some time to debug it. The file metadata is gathered by FileMetaDataWidget of baloo-widgets, which launches an external program (baloo_filemetadata_temp_extractor) to parse the file and return its properties, so the file description in the tooltip and the information panel is always correct. The preview is generated with KIO::PreviewJob(), which gets the mime type of the file from its name: kio/src/widgets/previewjob.cpp:304 calls kio/src/core/kfileitem.cpp:732, where QMimeDatabase is asked for the mime type based on the file name. This is wrong when the file suffix is wrong, and apparently there is a different preview generator for jpeg and png. I see three possible solutions: - QMimeDatabase supports parsing the file to find out its type - do not filter for mime type in PreviewJob, try all preview generators and accept the first success (the preview generators need to be ordered carefully to minimize the chance of false positive) - use the file properties gathered by baloo-widgets when requesting the preview (this needs new API in KIO::PreviewJob, and I'm not sure if KIO is allowed to depend on Baloo) I'm leaning toward option 2. It works fine in Okular for example.
Thanks for the investigation, Miklos! Would you like to submit a patch? I can help you out, and we have extensive documentation on this process: - https://community.kde.org/Get_Involved/development - https://community.kde.org/Infrastructure/Phabricator
I finally had the time to dig into the rabbit hole and fix all the stupid code trying to detect the file type based on the file name suffix. These patches should fix the previews in Dolphin: https://codereview.qt-project.org/#/c/231308/ https://phabricator.kde.org/D13314 https://phabricator.kde.org/D13315 https://phabricator.kde.org/D13316
(In reply to miklos from comment #15) It's amazing to finally see this solved after so long. Thank you! I hope the solution sticks this time and it doesn't break again in the future... ideally you can add code comments as well to make sure future developers know. Can't wait to see this fix in the next system updates :)
(In reply to miklos from comment #13) > Now I found this again, and I had some time to debug it. > > The file metadata is gathered by FileMetaDataWidget of baloo-widgets, which > launches an external program (baloo_filemetadata_temp_extractor) to parse > the file and return its properties, so the file description in the tooltip > and the information panel is always correct. > > The preview is generated with KIO::PreviewJob(), which gets the mime type of > the file from its name: kio/src/widgets/previewjob.cpp:304 calls > kio/src/core/kfileitem.cpp:732, where QMimeDatabase is asked for the mime > type based on the file name. This is wrong when the file suffix is wrong, > and apparently there is a different preview generator for jpeg and png. > > I see three possible solutions: > - QMimeDatabase supports parsing the file to find out its type Just for the record, QMimeDatabase already has this feature.
Git commit 0be80392f01e0ec01174990c430dcd8f1ed35d9e by Albert Astals Cid, on behalf of Miklós Máté. Committed on 16/01/2019 at 23:53. Pushed by aacid into branch 'master'. image thumbnailer: instruct Qt to look at the file contents when detecting its format This enables thumbnails in Dolphin for a png file named image.jpg for example. M +5 -2 thumbnail/imagecreator.cpp https://commits.kde.org/kio-extras/0be80392f01e0ec01174990c430dcd8f1ed35d9e
Git commit 880a09adae2abbf18f92c008fd4c109876a96581 by Nate Graham, on behalf of Miklós Máté. Committed on 19/01/2019 at 16:00. Pushed by ngraham into branch 'master'. manually set format in jpeg thumbnail creator Summary: Otherwise the QImageReader sets the format based on the file name suffix, which might be misleading, e.g. a jpeg file named image.png. Reviewers: dfaure, elvisangelaccio, #frameworks Reviewed By: dfaure, elvisangelaccio Subscribers: kde-frameworks-devel, kfm-devel, ngraham Tags: #dolphin, #frameworks Differential Revision: https://phabricator.kde.org/D13316 M +1 -1 thumbnail/jpegcreator.cpp https://commits.kde.org/kio-extras/880a09adae2abbf18f92c008fd4c109876a96581
does dolphin 18.12.2 include this fix? png files with jpg extension are still without thumbnail here. SOFTWARE/OS VERSIONS dolphin 18.12.2 Operating System: Arch Linux KDE Plasma Version: 5.15.0 KDE Frameworks Version: 5.55.0 Qt Version: 5.12.1
No, updated the "version fixed in" field appropriately.
Thanks for your work !
It's not working with Dolphin 18.04 beta. I changed the extension of a screenshot taken with spectacle from .png to .jpg and Dolphin does not show the thumbnail of the screenshot. Operating System: Arch Linux KDE Plasma Version: 5.15.3 KDE Frameworks Version: 5.56.0 Qt Version: 5.13.0
ops, I meant Dolphin 19.04 beta.
I can confirm comment #23. Only the reverse case works (renaming .jpeg to .png still shows the thumbnail).
That's odd. Thanks folks.
Still have this bug Operating System: openSUSE Leap 15.3 KDE Plasma Version: 5.22.4 KDE Frameworks Version: 5.84.0 Qt Version: 5.15.2