-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add a mode to link images in a different folder #1597
Comments
It would be interesting to support this and maybe it isn't too difficult. I'm thinking on adding a new button (Link File, probably under Import, like Insert Values... is under New Record) to write the selected file-name to the cell, possibly trimming the path part if it coincides to the DB path. For viewing, we could reuse the Image mode. First, it would try to interpret the content as an image and if it fails, as a file-name containing an image. The automatic switching wouldn't work for these linked images, as reading the file from disk would be too slow for that. But manual selection would do it. Would that cover your use case, @SilvioGrosso? |
One thing that springs to mind, is whether this could be abused. eg linking to (say) While that itself could have useful potential (eg some weird form of import 😉), would we be opening pandora's box and then wanting to try and shut it again. This might be all ok of course, I'm just putting the idea out there so we can think it through. 😄 |
Hello @mgrojo,
Yep. It would be great. In short, I need to move around, for backup purposes, to differente Drives (C:\ - D:\ etc), on Windows 10 - 64 bit, a folder containing:
Thanks a lot indeed! |
With me being a muppet, can you explain what your concern is behind this? Doesn't db4s have the same permissions as the user running it, so db4s can't import anything the user can't see anyway can it? Or am I (most probably) missing the point? |
Ok, that would mean that if the user selects the Image mode and in the cell it's stored /etc/passwd, then we would try to read the file and since it isn't an image, we would close it without using the content. Do you think that could be a problem? I guess it could only mean activating some alert if selinux or similar is activated and that is reported; or read access is denied. In my system the file is readable and no alert is produced (the passwords hashes are stored in /etc/shadow, which is unreadable as a regular user). I don't guess how reading an arbitrary file as an image could be maliciously exploited. But security is arcane knowledge for me. Would we need a special "Linked image" mode, so it is more obvious for the user that the referred file-name will be read? |
Yes, it seems that the proposal would fit your need. Thanks for the idea, it's a typical organisation of image data. I also thought of reading the file contents in XML and JSON modes, but that case would be more cumbersome, since these modes are editors and not plain viewers like the Image mode, so I finally disregarded the idea. |
@SilvioGrosso There's a way to get something closer to what you want, although a full "linked-image" mode implementation still seems useful to me. The trick is to load the fileio extension (see #1838) and use a custom display format to read the file contents and return it as a BLOB, i.e. It would be nice to improve the display formats feature, so the user can still modify the cell data using the original format. That would make this use cases more agile. On the other hand, if there are other interested people in a full-fledged linked-image mode, please up-vote this issue using 👍 in the issue description, so we can known how useful would be considered such feature. |
Hello @mgrojo Sorry for being late with my reply but these days I am on holiday :-) At present, as a complete workaround to any real sqlite database, I have been using LibreOffice Calc. Here is a screenshot of LibreOffice 6.2.4 Calc, on Window 10 (64 bit), with a small "database" (I have clicked on the firt image "Lizard" ("C2" cell and Picasa has been launched to display my image): What it is useful of LibreOffice Calc is that this option is "portable" in that I can move around the folder containing the LibreOffice Calc sheet AND the folder (and subfolders) with the images. Just out of curiosity, how long do you suppose it would take to develop such a feature on Db Browser for Sqlite? |
BTW, Just tried to load the fileio extentsion "fileio.dll" Unfortunately, it doens't work. |
It wasn't late at all, and holidays are for disconnecting 😄
That would be nice to have in DB4S, as already discussed in #1791 (comment)
Curious, given that the stored paths are absolute. Some fallback search mechanism, I suppose.
No idea. It depends on available personal time and motivation.
Where did you get the extension? Maybe there is some incompatibility. Does the "Error log" in "SQL Log" dock show something else? |
Thanks for your reply! Just tried again and the "Error log" is empty. |
Maybe @karim might help with that. |
Thanks! |
Had the same problem a while back with |
I found out why I wasn't able to load It turns out that sqlite CLI ( I have no problem loading and using it with DB4S though... @SilvioGrosso Do you have access to a Windows 7 PC, or a VM, that you can load the extension on? We had a problem like this before with another extention (SpatiaLite) that was working fine on Windows 7 but not on Windows 10. It is probably missing DLL like you said. I am not using Windows 10 so I can't test, but I will see what I can do. @chrisjlocke Can you load |
Hello @karim
Nope, I am sorry :-( BTW, I do own a computer with Windows 8.1 (64 bit) though. To recap:
Btw, I have tested this SQL code on Window 10 (64 bit) where this extension is not loaded: create table images insert into images values ( select * from images("D:\IMAGES_LINK\pictures\1.jpg"); |
Thanks for narrowing it down. It works with me on Windows 7, so it is something with Windows 10 missing some files.
This query is wrong. Your query should some something like...
However, this will return a row, but will not display an image. I don't think we have this feature implemented. |
Hello @karim
Ok. Now I have got it! Here is my working result on Windows 10: |
Nice. 😃 Is this what you were looking for? It is possible but not as simple as double-clicking a column with a file path for an image and it will automatically open an image viewer. @mgrojo mentioned that this is possible using the same method you just used now.
I don't know how this is possible. 😄
|
Hello @karim
Yep, this image, with a Lizard on it, comes up from this discussion:
Yep. I didn't know about that because I never opened this tab (option) before. |
I'd like to maintain this issue open for the possible enhancement of a linked image mode. It is not currently discarded 😄 |
Hello @mgrojo Thanks a lot for not closing this ticket :-) Just checked again LibreOffice Calc 6.2.4 on Windows 10 and I have realized how it works as regards the abolute - relative link to an image. When you cut the whole folder containing the images and the LibreOffice Calc sheet a new path is automagically created. On Windows 10 it is pretty straightforward to get the link for a bunch of images.
At present, this is the best I can achieve with Db Browser as regards my images :-) At present, I am quite happy with Calc as a "database" for my pictures since on Windows 10 this workflow works like a charm. Thanks a lot for you work on Db Browser! |
You keep closing this ticket whenever you answer 😄 If this is not intended then we have some poltergeist 👻 |
Sorry about that (closing issue) it was not intended ! :-) |
A new button is added in the "Edit DB Cell" dock for interpreting the current value as a URL or filename and opening it using the default application for the file or a web browser for the URL. The same can be directly invoked in the table browser using the same shortcut as the FK navigation. Related issue #1597
The "Import file" in the Edit Dialog dock is converted to a menu (after long click) with a new action for selecting a file to be imported as a reference in the cell. Then this filename reference can be used to open the file using the default application with the present "Open in Application" action. (In Linux, paths containing non-US-ASCII are known not to work. This seems a bug in Qt QUrl class). New icon composed from our document-open.png and link.png from Silk icon set. Related issue #1597
@SilvioGrosso I think this enhancement is mostly implemented. I needed support for opening URLs from database cells. Adding support for opening local files from cells and for inserting references to files, instead of file contents, was then straightforward. Relative filenames are interpreted from the current working directory. That could not be very useful except when launched from the command line, so we could improve it to use the DB file location as base. We should think about that. Instructions:
Could you give it a try with tomorrow's nightly build and report any rough edge or suggestion? |
…actor When opening a relative filename from "Edit DB Cell" or Table Browser the relative paths are interpreted from the DB file location. This allows portability of DB and linked files to a new location. Refactoring so the open URL code is centralised in MainWindow and a status message is displayed with error or opening notification. See issue #1597
I've just commited an improvement that uses DB file location for relative paths. This will be definitively better, since current working directory is too unpredictable (I guess in Windows, when launched from the application menu, will be the directory where the program is located, and that isn't very useful. There is also a message in the status bar when files or URLs are opened. |
Hi @mgrojo ! Just downloaded the last nightly (for Windows 10 - 64 bit, as usual): In all truth, I didn't find the button "Cell Edit" in the "Edit Database Cell (CTR+E)" At present, to work with images (that is, mostly jpeg since they are compressed) with Db Browser I follow 3 different options: For instance, INSERT INTO IMAGE VALUES BTW, I have noticed that importing a file (jpeg) works fine the first time it is imported ("Import from file" icon). But later on, when I set again its mode as 'image' the jpeg is not visualized anymore (the box to visualize it is grayed out). To make it work (show) I need to import it once again... Here is a video with all 3 methods with yesterday's build (DropBox link): You can notice the lack of the button "Cell Edit" in the GUIs and the problem with visualizing image later on when they are imported (row number 2 of the table IMAGE) A very minor glitch is that the Sql query ("Execute SQL" panel): |
Sorry, I meant that there is a new button in the "Edit Database Cell" dock (I always try to abbreviate that name). The button is this: The button to import the filename is: . It is accessible after a long click over: . Although your current method of copying the file from the Windows Explorer works well also.
After importing the file, the data is loaded in the "Edit Database Cell" editor, but not into the DB. You need to click "Apply" there. I knew that this second action for importing could be easily overlooked. The same happens with the new "Save file reference..." button.
I'll take a look; it could be improved. By the way, I've committed a new enhancement for loading embedded data with the default application for that file type. There is a new button in "Edit Database Cell" dock , which saves the cell data to a temporary file with extension according to detected data and opens default external application for the file type. It then asks user to reload the data in a dialog when they have finished editing the data. It can be also used for viewing if the user cancels the reload. This enhancement will be in the next nightly build. |
Hi @mgrojo
Ok. Now I have got it :-)
Thanks! |
The next nightly will allow you to configure the "Adjust rows to content" (see issue #2006), but you would have to save the query as a view first (there's a button to make that easily), because in the query results for "Execute SQL" tab, you won't be able to enable it. This is probably work in progress. |
@SilvioGrosso The release 3.12.0 has been published and it includes this enhancement, so I'll close this issue now. If there is something that could still be improved, please open a new issue. Regarding row height, we already have:
|
Describe the new feature
It would be great to have a new option to add a link (url) pointing to a folder with some images in order to visualize them in Sqlitebrowser one by one.
In essence, each row of the database might contain the path of one image.
For example,
ID | description | Location
1 |rose_flower | C:\Users\silvio\Desktop\flower\rose.jpg
2 |tulip_flower | C:\Users\silvio\Desktop\flower\tulip.jpg
At present, you can import an image into your database as blob. In the long run, however, you quickly increase the database size and make it much slower to work with.
By having the images separated from the database this one would remain small as regards its size.
Additional info
As regards the link, it would be important to get the path of your image saved as relative in order to easily move the database and the folder with your images in different drives (whenever you decide to backup them).
For instance, you create a new folder in the C:\ drive and save in this same folder your database and your images as well.
Later on, whenever you move this folder, with both your Database and your images, for example into the D:\ drive, Db Browser is able to visualize your images even though the path has been changed (from C to D).
Does this feature exist in another product or project?
This options is available with QGIS, an open source GIS software.
Usually the images have their GPS data (latitude and longitude) so that you can visualize them in their exact position in your map [1]
[1] https://gis.stackexchange.com/questions/251023/link-pdf-jpeg-to-locations-in-qgis-all-coming-from-a-standard-folder
The text was updated successfully, but these errors were encountered: