Yo.
I have installed Gallery. It looks like it's the only PHP web gallery that works ;) and I like it.
So, here is the deal. I have lots of RAW photos in Lightroom, organized in folders, tagged with keywords, and rated. So, I export all this as JPEG. Lightroom, being stupid, puts everything in a flat folder. So, I write a 5 minute Python script to rebuild my folder organization.
Then, I use a Photoshop script to resize, sharpen and Save For Web (TM) all this. I generate 1680x1050 for display on my LCD, and 1024x768 for web use, both have different sharpen settings. Unfortunately I can't do this directly in Lightroom since it only supports one sharpen setting.
I re-run the little script to rebuild the folders, and hooo ! everything imports cleanly in Gallery2, I get one album per folder, it's really neat.
But, the tags and keywords and EXIF crap got lost on the way (in Save For Web) and the ratings were not exported by Lightroom anyway. Also, all the dates are from 2 hours ago instead of being the real photo dates.
So, I hit the Lightroom SQLite database with a few queries (so cool of them to use an opensource database) and I can get my data back without a problem : filename (which is unique, ie. usable as a primary key), tags, ratings, dates, titles, captions, etc... But, how do I tell this to Gallery ?
I would really like if someone pointed me to the queries to perform on the Gallery database (or the API if it supports that, it doesn't seem to) in order to :
- get the ID of the image in Gallery's database from the filename.
- insert the tags, ratings, dates, titles into gallery's database.
Thanks ;)
Posts: 17
Update :
Thanks to jhead (http://www.sentex.net/~mwandel/jhead/) I made a little Python script which scans a directory tree of source images, and a directory tree of destination images (not necessarily with the same directory names), and calls jhead to copy the EXIF data.
Now all my Save for Web'd images have their EXIF back.
Since Gallery2 does not store the EXIF in the database, instead reading it from the JPEG every time, this was the only solution.
Now for the rest.
I can easily extract : keywords, filenames, ratings from Lightroom's database.
The title and caption are stored ONLY in the xmp file which is stored inside the database. Dumb.
The exported JPEGs contain keywords and title (that Picasa can read, but not my Python lib), and probably not ratings. So, I will forget about EXIF for keywords, ratings, titles etc, and rip them from the database directly...
Posts: 17
OK, so I have developed the following lightroom / gallery2 workflow :
- import stuff into lightroom, check, sort, move into folders, etc
- check that all filenames are globally unique (using Lightroom's auto-rename works well for that)
- develop photos, crop, etc, mark the good & bad ones
- tag, put keywords and titles (still in lightroom)
- export the good ones at full resolution to a separate directory
- run a photoshop script to resize / sharpen / save for web
- Run python script to copy EXIF from original pics to saved pics
- Run python script to rebuild the original directory tree in the export dir
- upload to server
- Gallery automagically scans the dirs and adds the pics
- Recheck that albums have correct names, set correct dates on new albums, add some comments to albums
- Run python+php lightroom/gallery2 script which transfers ratings, keywords, titles, captions etc, from lightroom's database, to gallery2
Thanks for the help, lol.
I still have a little problem with Unicode accents getting transformed into crap at some point. I guess this is due to PHP's ignorance of Unicode... Have to investigate.
Posts: 17
Everything works.
Posts: 397
Am surprised no one responded to this. This sounds like a very cool application of transferring metadata...
Posts: 38
Hi...
And there is no code..
/Hemsoe
Posts: 17
I don't like to release undocumented (and therefore rather unusable by others) code. So I will take the time to document it and make a webpage for it, if people are interested... Are you interested ?
Posts: 397
Yessir. Very interested.
drhiii
Posts: 1
Hi, I just got gallery setup again last night. Trying again to tame the beast of choas and duplicates in my photo collection. I am hoping to make gallery my central repository. However, I have lots of data in lightroom I'd like to import/sync. Even if the code is not ready for wide distribution, I'd be interested in at least reading thru it to get it working, or get ideas how I might get something similar working
+1 interested
~Michael
Posts: 17
I started writing the manual... I should have enough spare time to finish this tomorrow I hope.
Posts: 17
Yo.
Here is the code, with a PDF manual covering installation instructions for the required tools, and how to use it.
I submitted a project on SourceForge, but it needs 2 days to be approved. In the meantime, you can get the code there :
http://home.peufeu.com/temp/gallery2lightroom.zip
This is beta (works for me...) so please tell me about your experience, if it works, what I can improve, etc.
Please don't ask for a GUI, though ;)
See ya
PS : the code that reads metadata from Lightroom is easily replaceable by some other code which would read its metadata from another source (Aperture, whatever) if someone wants to write it.
Posts: 64
This sounds really useful. I have one comment- I use Photoshop (CS3) to generate my web images, but don't use Save for Web. I just run an action that converts to sRGB and resizes and sharpens appropriately. I don't find this strips the EXIF out, and the images look great on the web. I import the images into Flickr and Gallery, and all the EXIF and IPTC data is imported just fine. Seems like you've solved the issue for yourself, but if the EXIF wasn't stripped in the first place, it would save you some steps. All the EXIF camera settings are imported too.
-----------------------------
www.lightpainter.co.uk
Posts: 17
I think Save for Web results in smaller files... if your website resizes or otherwise processes the images (like Flickr, Picasa or Gallery2 if you use the Resize feature), it won't make a difference, though.
Posts: 32509
@Peufeu:
is this independent of http://moritzpost.de/photography/2007/11/23/lightroom-to-gallery-export-plugin/ ?
your integration sounds more tight (ratings etc), at the expense of a more complex configuration since the Gallery-Remote protocol doesn't expose this data yet.
either way, this is great. please add your tool to the list of clients at:
http://codex.gallery2.org/Other_Clients
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 32509
After looking at the packages it's clear that the two are pretty different.
@Peufeu:
I'd highly recommend to use the Gallery API on the server component. By using the API, your integration will be much more robust and will have less limitations.
I see that you can't use the webdav or GR protocol for now since neither of them expose item ratings. GR doesn't expose the originationdate as far as I know. webdav exposes everything you need, but ratings. If you could submit a patch for the webdav module to handle ratings in proppatch requests as well, you could remove your server component and just talk webdav with the g2 server.
And we're working on a new web services / RPC API which will be easier and more powerful than the current GR protocol.
So I understand that you can't use GR/webdav for now. So you have to write your own server component.
But why not use the Gallery API (GalleryCoreApi, ...)? Your current code is limited to a table prefix of "g2_" and only works with MySQL.
Also, the likelihood for bugs/security issues with your server component is much larger than if you'd use the Gallery API. The reason is simple: It's a lot of new code and it's bypassing all checks / layers of G2. Sure, you can try to account for all that, but bug-free code is a rarity. It doesn't exist in practice.
Don't get me wrong. I'm very excited to see your Lightroom <-> G2 meta-data integration! I just want to avoid potential data-corruption or even security problems and adding a new server-connector (your server-side script) introduces such a risk, largely unnecessarily.
I'd be glad to guide you in either transforming your server-connector to a GalleryEmbed API / GalleryCoreApi script making as much use of safe Gallery API methods as possible. Or transforming the client to use the GR or the webdav protocol and patching the server's protocol implementation to handle ratings too.
Maybe there's also potential in joining forces with the other Lightroom integration.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 17
Well, the reason I used Gallery is that I needed a web gallery for my photos and I did not have the time to write one myself. So, I tried at least 5 php gallery packages and settled on Gallery2, simply because it comes with a good-looking template with a dark background, and it works. Most of the packages I tried either didn't work (ie. bugs, etc), or were hard to make look good (no CSS, bad HTML, etc), or both (mostly both). So, even though I chose Gallery2, I still think it sucks in many ways, notably lacking such very basic features like support for tags, good handling of keywords (current handling is very crummy), you can't make the same photo appear in more than one album, etc. Really, G2 pulls some pretty incredible coding tricks like dynamic install and loading of modules, but the end result as a web gallery is well, pretty basic. Still it does what I need, and it looks good, so I'm not btching in the forums, and I'm happy with it.
Before writing my code :
- I had a look at the G2 API "documentation", and concluded it would be faster to write my own protocol than to use the G2 API since it's a bit messy and the docs are... er... well, lacking.
- I have Lightroom 1.2 not 1.3, so I can't write Lua plugins. Perhaps when I get 1.3 I'll try to learn Lua. Also when I change a rating in Lightroom or correct some meta-data I want to reflect the change in G2 without having to export images, which takes a long time, so a Lightroom Export Plugin wouldn't be enough for what I want.
- I had a look at G2's code and decided not to touch it with a 10 foot pole since the really nifty features like dynamic module loading imply an horrendously complex model, and there are no comments.
This code suits my needs, I like to release it and write docs so that others can use it, but I won't have time to contrinute or integrate it into gallery. Sorry ;)
Posts: 378
I finally published the new release for my plugin.
New features:
* Fully compliant with Lightroom 2.x SDK.
* Support for Gallery 1.x, Gallery 2.x and Jallery 1.x
* Available in English, French & German.
* Still user defined export of Lightroom metadata to Gallery.
You can find it there: http://www.starway.org/blogs/Photographie/lightroom-gallery/
By the way, I hope Gallery 3 will provide a better API to manipulate the Gallery from an external application ;)
Posts: 17
Now we have Lightroom 2, which among other improvements, writes EXIF to exported files (at last).
However it still puts all exported files in a flat directory, losing the organization.
The new V2 of my Lightroom2 -> Gallery synchronizer will be finished shortly.
It is not an export plugin (there are already plugins to do this).
What it does is basically take all the information in the lightroom database, and update Gallery2's database to reflect this.
So, if you add keywords to a photo, or change the keywords, title, description, ratings, etc, and run this program, all your changes will be magically applied to Gallery2.
Thus you don't need to edit anything in Gallery2, just edit in Lightroom and run the updater.
Gallery2 is still utf8-challenged when reading keywords from photos, and ignores the rating field. This program fixes those issues, storing proper utf8 strings in G2's database.
However, before I release it, I still have a problem with virtual copies.
To link photos in lightroom to photos in Gallery2, I use the filename, since this is the only practical way (Lightroom doesn't embed any Unique ID in the images, which is a IMHO a bug).
This means all filenames have to be unique. I name all my photos with date-original filename so it works for me.
However virtual copies have the same filename (in lightroom) and the export filename (ending in -1, -2 etc) can't be guessed from the database. Lightroom also doesn't embed any information in the images (AFAIK) that would permit proper linking a virtual copy to the exported photo.
So, right now, it doesn't work with virtual copies. Perhaps Lightroom 3 will fix this...
If someone has an idea about this, I'd be happy to use it. Else, I'll release the code for Lightroom2, with this known issue.
This is, and remains, a quick hack, but it works. No, I'm still not interested in using the G2 API, unless it is easy, and allows bulk updates. This program works like this :
- query a php script on G2 which returns the metadata for all photos
- examine the data and compare to lightroom database (Python, SQLIte)
- upload a list of modifications and apply in bulk
It is pretty slow (it can take several seconds to update metadata on ~10K photos) but still usable.
[i]I'll post a zip maybe tomorrow. Have to write some docs.
Posts: 378
This is interesting.
Regarding your problem, I was expecting the solution on the other way arourd : Flickr assings an UID to every picture, and this UIS is stored in the catalog when the pictured has been published by Jeff's plugin. I am expecting the same feature in Gallery. However, the Gallery Remote API does not provide any such information. So this is not doable in G1/G2. I still hope that G3 will expose some kind of UID of the picture.
This way, pictures can be reuploaded (bigger, better treatment, etc.) or updated if the metadata has been changed.
Lightroom 3 also provides some new publishing service, however, I am not very sure this will be very convenient in G2/G3 if several (10+) albums are used.
By the way, this method might not work for me : the files generated for Gallery do not have the same filename as the original file...
Posts: 4342
It's very easy.
Even if there isn't an API directly for bulk updates, there's an API entry for building and running sql queries which doesn't bypass the security checks and is compatible across all supported dbs.
I'm happy to help you with the g2 API.
Posts: 17
Interesting. Let's consider that :
- all the tagging, keywording, assigning titles and descriptions etc, should be done in Lightroom (and not repeated in Gallery)
- this information can change (maybe you come back later to fix/add keywords or edit a title)
=> need for an automated metadata update for existing images
- you can also modify a bunch of images a bit, change the develop settings, and want to upload the new versions to Gallery without having to manually find the old ones and replace them
- maybe next year you get less paranoid about copyright, or you get a cheap new web hosting with plenty of space, and all your friends with HD screens complain about your tiny photos, so you'd like to re-upload larger versions of all your images,
- or the new ACR engine in LR 3.0 makes your photos look a lot better
=> need for a way to re-upload a batch of images to replace existing ones
Since this would be an extremely useful, why not do it ?
I think we need a mix of Lapinou's export plugin and my stuff, which would do the following :
1) Export to Gallery and create a link between Lightroom's images and G2's images during the export
This "link" is the essential part : as seen above, the filename is a pretty crummy way of doing it ; I used that only because I had no other choice, but frankly, it's ugly, doesn't work if your filenames are not unique or differ between Gallery and Lightroom, etc.
We need something like a GUID stored inside the EXIF, IPTC or XMP data, at export, inside the photo itself.
If you dug a bit in Lightroom's database, you may have noticed that Lightroom ALREADY generates GUIDs for images and stores them inside its sqlite database ! Unfortunately, it doesn't include it inside the exported files' metadata. Could Lapinou's export plugin grab those ?
The GUID could also be generated by Gallery, and added to Lightroom by Lapinou's plugin.
Then there is the problem of taking an existing Lightroom catalog, an existing Gallery, and linking all the existing photos. Using capture times, filenames, and/or some image matching, this should not be too difficult.
2) Synchronize Gallery
Once each image has a GUID on both sides of the fence, updating meta-data and re-uploading new versions can be made push-button.
For metadata updates, though, a bulk API is really needed : here, I have a bit of PHP that dumps all the photo information in JSON format. Python parses this easily. Then a list of updates is sent (basically a list of image_id, fieldname, new_value). It is simple and extremely fast.
I think we should wait for LR 3.0 since this will have a more interesting plugin framework to work with.
Posts: 378
As a LR user:
So I completely agrees with uploading and updating pictures in Gallery.
Uploading is "easy", but updating is a real problem in G2 and will continue to be. Storing LR picture UUID in Gallery is impossible right now (GR interface), the opposite is also impossible (GR does not provide any UUID for the uploaded picture).
From my perspective, only Flickr is "user friendly" for my workflow :
I wished G3 was designed to be more friendly for users who use Gallery to display them onlines. That was not the case since the requirements of the majority guided the choice to continue to manage pictures within albums (like G1 and G2, not like Flickr). I'll check what we can do with LR 3 and G3 (when the new remote interface will be made available), but I do not plan to develop new features for the plugin that:
Posts: 17
Considering the export plugin, is it possible to add the Lightroom GUID to any of the embedded fields inside the JPEG file ?
Posts: 21
Has there been any further work done on this? Or any other threads that contains more up to date information on this?
I would love to see a "publishing service" for LR3 for G2 and G3. I'm willing to share in the code writing as well but I just haven't started investigating as what's already out there.
Posts: 378
The current plugin works with LR3 and G1/G2.
I'll wait to see how the REST interface of G3 progresses before doing any work.
However, don't have huge expectations : neither G1, G2 nor G3 assigns unique IDs to the pictures, so having a publishing service working as the Flickr one is impossible. If for instance you move a picture/rename a picture in Gallery, there is no way to link it back to an element in LR. That's a shame.
Posts: 4342
G2 certainly does - the itemId is guaranteed unique and constant. G3 has an internal id too that functions the same way, although there's some debate about whether that's externally available with the REST interface. You may want to contribute to the debate on the developer's mailing list if you haven't already.
Posts: 378
Well, the real problem is that the Gallery Remote API does not return nor manipulate G2 elements with IDs.
The id would be useful :
- to reupload an element (even if it has been moved or renamed in Gallery)
- to track comments on a picture (new LR3 feature)
Posts: 4342
It's not obligatory to use the Gallery Remote API, although I can see why it's attractive. There's no reason why you can't write a G2 module that provides the interface you need, it would be quite straightforward.
Posts: 378
Well, I tend to prefer to reuse the work already done.
If everyone who needs to interface Gallery with an external application (Gallery Remote, Lightroom, Aperture, ACDSee...) had to write a Gallery module, then we would end up with a lot of different modules, all probably incomplete and having different bugs.
Moreover, if was not a huge investment to understand LR API and the LUA language. However, if I had to study as well the Gallery model and API in order to have a working solution, I don't think I would have started the work.
So from my Lightroom developer point of view, Gallery 1 & 2 come with an API to manipulate content : it's called Gallery Remote, and I try to do as much as I can with it.
Posts: 4342
OK, I understand. But the problem you're having isn't anything to do with Gallery structure.
Posts: 378
Yes, in the ends it depends from which point of view you look at things.
Maybe the core is perfect, I honnestly don't know. However, From my perspective, this is something that is note easily done.
For instance, I saw that Übermind is featured on the Gallery site. Übermind used to make a plugin for Lightroom too. They used the Gallery Remote interface, so I guess they're doing the same for the Aperture and iPhoto plugin (the feature list matches was is possible with the GR interface).
This means that the official API to access Gallery content is important: whatever are the core feature, in the end Gallery is limited by the features provided by its official API.
Posts: 4342
The "official API" is not Gallery Remote. The official APIs are documented here:
http://codex.gallery2.org/Gallery2:API
The main one, the Gallery Core API is the one that allows you to write a module to interface with lightroom, to access unique ID's for each image, to store lightroom IDs (if there are such things) in a private database table for cross-referencing along with other data you might need - and program anything else that you want to do with Gallery2.
I think you're artificially handicapping yourself by insisting on using Gallery Remote, which is not well supported by the core team and very peripheral to the G2 product. There's nothing either difficult or wrong with writing your own interface to G2; Many modules do that without being "incomplete and having different bugs" as you suggest they might.
Posts: 378
I strongly disagree with GR not being an official API:
Then, why I won't write a new module for Gallery:
And finaly, even if G2 could have supported external IDs to external tools, G3 doesn't seam to support this. Let me quote Tim:
You can check the whole discussion at http://old.nabble.com/REST-docs-to27351326.html
So, to sum up:
Posts: 4342
Did you contribute to the debate on the G3 REST? If not, you should. If it doesn't do what you want it to, the onus on you *now* is to persuade the developers to change their plans.
I agree it would be nice if the G2 Remote protocol was usable for your purpose. And I understand that you don't want to write a module for G2. But that's a personal choice - someone else might want to - and could easily - write a G2<->Lightroom Plugin that way, even if that person is not you.
Posts: 378
Yes, I tried, however my subscription to the mailing list was with my old address that is now redirected to my new one, so when I replied the mail got bounced back... I never took the time after to try to fix this, especially since the discussion showed that my position was not the position the majority was thinking for G3.
I would have loved to have a better protocol for accessing G2. But I think this module should not be aimed to any tool in particular. If well done, Gallery Remote, Lightroom, Aperture, iPhoto would all use it. I think Pierre-Luc (Gallery Remote maintainer) would have loved it too!
Note to G2 developpers and LR users : if someone wants to improve my module and plug it in G2 with a specific G2 module, please do!
G3 is a nice step forward with its REST interface, but in the end it is still not the best solution for LR / Aperture users who manage a photo collection and want to display it online. G3 would have needed to be more like a Flickr on your website (with themes) to be perfect for this purpose.
Posts: 4342
I think it's *really* *really* important that you speak to the developers about this regardless of what the majority thinking was. They are all reasonable people, who want G3 to be useful for people to do new things with. Please explain to them why you need access to a numeric ID for the photos. They may be able to suggest a different way of doing it, or they may change their approach - who knows.
Posts: 1
I was wondering if it might be possible to get a copy of your most recent plugin. I just purchased a copy of Lightroom 3 and I'd like to extend it to support a few additional metadata fields (for example, allowing for Photo Captions to uploaded to the extended description field).
I have a very old version of the plugin that works, but it lacks these additional features. I'm wondering if the version you have been developing might include them.
Posts: 378
The latest release of my plugin is on my site (http://www.starway.org/blogs/Photographie/lightroom-gallery/) or on Adobe Exchange web site.
I haven't start to play with LR3 new features and check how those could be incorporated in the plugin, but I'll do when I'll find some spare time.
Since the plugin is GPL, you are totally free to do whatever pleases you with the code!