Bug 499241 - No preview shown when file extension does not match actual image type
Summary: No preview shown when file extension does not match actual image type
Status: CONFIRMED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 24.12.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-28 15:02 UTC by Gergely HORVÁTH
Modified: 2025-02-07 15:12 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gergely HORVÁTH 2025-01-28 15:02:18 UTC
Hi,
I realized that jpgs in a folder have no preview for jpg files. Pngs, webm and everything else has jpg previews, even better in other folders jpg previews show up. But! When I turned off previews for dolphin (Settings->Dolphin settings->Preview->Jpeg, untick, click Apply), the thumbnails showed! When I turn it back off, the thumbnail disapper. If I move the image between that folder and other folders, the experience is the same.  The images I experience it with are downloaded from bonjourmadame.fr (NSFW), so it may be the images from that site (but the webm, png files from the same site show no trouble). I experienced it with a single folder where I collect them, that folder is synced to Nextcloud with the official app, but the connection may be the source of the images.
So in summary: jpg files from that site react to "Show JPEG thumbnails" reversed compared to what the tick suggest in dolphin. Example image: the one from 2025-01-28 (the page uses /page/n numbering, don't see permalink option)
Hope you can look into it!
BR,
Gergely

Versions:
```sh
$ pacman -Qs dolphin
local/dolphin 24.12.1-1 (kde-applications kde-system)
    KDE File Manager
local/dolphin-plugins 24.12.1-1 (kde-applications kde-sdk)
    Extra Dolphin plugins
```

Operating System: Arch Linux 
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.12.9-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-6700K CPU @ 4.00GHz
Memory: 31.2 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1080/PCIe/SSE2
Manufacturer: Dell Inc.
Product Name: XPS 8910
System Version: 1.0.9
Comment 1 Akseli Lahtinen 2025-01-29 10:36:17 UTC
Can't reproduce, for me the images go away with checkmark off, as expected.

dolphin 25.03.70
Operating System: Fedora Linux 41
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.1
Kernel Version: 6.12.10-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 2 TraceyC 2025-02-04 23:20:52 UTC
I'm also not able to reproduce this problem on Dolphin built from git-master
jpg previews show when preview is on, and do not when it's off

I'm not easily able to find a jpg from the site you are downloading from. The images for me are all webp, even the one for 2025-01-28
How are you downloading the image? I was using right-click save as.
Comment 3 Gergely HORVÁTH 2025-02-05 20:07:46 UTC
Interesting. I generally
- use Mozilla Firefox (134.0.1-1 on Arch)
- Right click the image
- click "Open image in new tab", that opens only the image in a new tab
- Right click that image -> "Save image as", and that is a jpeg
I just tested what you said and it does download a webp when directly saved from the page. And interestingly it is not reproducible with Chromium, there the image in the new tab stays a webp. It still happens with todays image (Chromium keeps it a webp, Firefox "open image in new tab" results in a jpeg, with which dolphin strugles presenting the preview, until I disable previews for jpeg).

I don't know what is happening when clicking Open image in new tab, I thought maybe FF is converting webp to jpeg for some reason. However, going to https://kde.org/, scrolling KDE applications down all the way to Krita (just above devices), the Krita image is a webp (the above images seemed png or svg), clicking right click to save tries to save it as a webp, but opening it in a new tab, it still downloads as a webp. No conversion there.

So another idea: maybe bonjourmadme is using some kind of blog engine that convert images for presentation?

Maybe it is my resolution: 2880x1800 scaling factor: 150% (maybe firefox is doing some rescaling that is why it ends up with a jpeg?). 

Does any of it helps to reproduce?
Comment 4 TraceyC 2025-02-07 15:12:53 UTC
Thank you for clarifying how you download the images. If you inspect the properties of one of these files, you will see the problem.
1. Right click one of the downloaded files with the .jpg extension and choose "Properties"
2. Look at Type and Content. What I see is 
Type: "JPEG image"
Content: "WebP image"

The problem is that the file is actually a WebP image but has the wrong file extension of .jpg
Rename the file to have the correct extension and the previews will show as expected.

The bug in Dolphin is that it should be using file properties to show the preview, not the file extension, since that can be wrong

I can reproduce this on git-master

STEPS TO REPRODUCE
Make sure previews are enabled in Dolphin
1. Download a sample webp image from a site like https://toolsfairy.com/image-test/sample-webp-files#
2. Open the folder where the image is in Dolphin. The preview is shown at this point.
3. Change the file extension to .jpg. 

Result: The preview is no longer shown
Expected: the preview is still shown