Bug 323112 - Preview fails when importing images because digiKam uses a wrong path with Gphoto2 camera [patch]
Summary: Preview fails when importing images because digiKam uses a wrong path with Gp...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Import-Gphoto2 (show other bugs)
Version: 3.2.0
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-02 15:42 UTC by Stefano Ferri
Modified: 2017-08-15 21:58 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.6.0


Attachments
gphotopreview.patch (3.11 KB, patch)
2014-12-10 21:48 UTC, Maik Qualmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefano Ferri 2013-08-02 15:42:35 UTC
In thumbnails view, when I'm importing images from my camera (Canon Powershot A710 IS) and I click on an image to activate the preview (or, that is the same, I click on the proper button in the toolbar) Digikam says it cannot load the image.
The problem seems to be a wrong path: Digikam correctly retrieves the thumbnails but when needs to load a bigger preview it uses a wrong path. Here there is an example of output message if Digikam is launched from a shell:

digikam(24732)/digikam (core) Digikam::PreviewLoadingTask::execute: Cannot extract preview for  "/store_00010001/DCIM/IMG_7278.JPG" 
No location could be retrieved for url KUrl("file:///store_00010001/DCIM/IMG_7278.JPG")

The correct path should be, instead, file:///store_00010001/DCIM/100CANON/IMG_7278.JPG . In fact, my camera stores photos in subfolders of a parent folder DCIM (located in the root of the SD card), and these subfolders are named 100CANON, 101 CANON, and so on. Digikam doesn't use the complete path.

Reproducible: Always

Steps to Reproduce:
1. Connect a camera and go to the import panel
2. Switch from thumbnails view to preview mode by clicking on a thumbnail

Actual Results:  
Digikam says it cannot load the image

Expected Results:  
Digikam should load a preview

I think that, for reproducing this bug, you need a camera that stores files in a structured tree. For example, mine (Canon Powershot A 710 IS) stores them in a structure DCIM/100CANON/. Digikam misses to go through the whole path.
This problem is only related to the import mode: preview in album view works.
Comment 1 Teemu Rytilahti 2013-12-02 16:10:29 UTC
Can you try and see what gphoto2 -L gives to you? Are the paths correct there?
Comment 2 Teemu Rytilahti 2013-12-05 01:32:29 UTC
Can confirm with Nexus7 and MTP.
Comment 3 Teemu Rytilahti 2013-12-07 20:16:55 UTC
The cause for this is that when you are using a MTP/PTP device the path in CamItemInfo is set to be the path inside your device. And when digikam tries to load a local file with that it of course doesn't work.

Possible solutions:
- Disable the preview mode completely for non-UMS devices.
- Implement loading the file to a temporary file when being previewed and load it from there.
Comment 4 caulier.gilles 2013-12-07 21:53:21 UTC
Teemu,

I vote to disable preview with Gphoto camera in first. It's easy to do...

If time permit, the temporary download can be done, but it's not a priority... There are more important bug to fix in first.

Gilles Caulier
Comment 5 Stefano Ferri 2014-01-05 09:15:00 UTC
(In reply to comment #1)
> Can you try and see what gphoto2 -L gives to you? Are the paths correct
> there?

Yes, they are:

$ gphoto2 -L
There is no file in folder '/'.                                                
There is no file in folder '/store_00010001'.                                  
There is no file in folder '/store_00010001/DCIM'.
There is no file in folder '/store_00010001/DCIM/100CANON'.
There are 276 files in folder '/store_00010001/DCIM/101CANON'.
#1     IMG_0514.JPG               rd  3129 KB 3072x2304 image/jpeg

[.......]

#276   STA_0511.JPG               rd  4938 KB 3072x2304 image/jpeg
There is no file in folder '/store_00010001/MISC'.

I'm sorry for this late reply, I've access to the mentioned camera only in some periods, especially holidays, since it is not mine (it's my father's camera).
Comment 6 Maik Qualmann 2014-12-10 21:48:03 UTC
Created attachment 89913 [details]
gphotopreview.patch

This patch disables the preview at GPhoto driver and the context menu "Open With...".
Comment 7 caulier.gilles 2014-12-10 22:01:28 UTC
Git commit 7b71987a7f401cf5f906e992382afb5157584630 by Gilles Caulier.
Committed on 10/12/2014 at 22:00.
Pushed by cgilles into branch 'master'.

apply patch #89913 from Maik Qualmann about to disable preview mode with Gphoto2 camera
FIXED-IN: 4.6.0

M  +6    -1    utilities/importui/main/importui.cpp
M  +1    -0    utilities/importui/main/importui.h
M  +5    -0    utilities/importui/views/importview.cpp
M  +2    -2    utilities/importui/widgets/importcontextmenu.cpp

http://commits.kde.org/digikam/7b71987a7f401cf5f906e992382afb5157584630