[SOLVED] mass re-upload

HeikoSchlittermann

Joined: 2012-11-24
Posts: 4
Posted: Sat, 2012-11-24 21:50

Hello,

I'd like to do a mass re-upload.

I found the the hint to the reupload module (see http://gallery.menalto.com/node/54127).
But I'm not talking about 2 or 5 pictures, I've to reupload about 500
elements.

Without any problems I can update the files in the album folders, but -
how can I have the gallery engine to re-scan these files for the new
picture attributes (notably the dimensions)?

Thank you for any hint.
--
Heiko

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2012-11-24 22:02

are you uploading larger/smaller versions w/ the same filename?
or has the aspect changed?

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
HeikoSchlittermann

Joined: 2012-11-24
Posts: 4
Posted: Sat, 2012-11-24 22:33

I'm uploading larger pictures (same aspect ratio). (Because unfortunately during the initial upload via gallery remote the resize checkbox was checked.)

(PS: I'm already playing with the database (tables g2_filesystementity and g2_photoitem) and changed the g_width and g_height fields to
match the orginal (and replaced picture), but this does not seem to work. - may be there is some caching or some other place where
the size is stored too.)

EDIT: Just purged the database cache. It seems that now G2 took the new size.

EDIT2: The issue seems to be solved - just the question, if there is
some simpler solution, remains.

What I did (and have to do for the about 500 items)

- replace the file in the album/** folder with the
new version

- find the new dimensions (using "jhead")

- update the database (update g2_photoitem set g_width = $WIDTH,
g_height = $HEIGHT where g_id = (select g_id from g2_filesystementity
where g_pathcomponent = '$FILENAME');

- purge the cache of the database

Fortunately I've uniq filenames - thus the g_pathcomponent is unique
too.

The about outlined solution is scriptable (perl, shell or whatever).

--
Heiko

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2012-11-24 22:29

it would be fairly simple to write a filesystem iterator to walk the filesystem from g2data/albums and grab the $item's id -> load $item by id -> $item->setHeight($h) -> $item->setWidth($w) -> $item->save()

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
HeikoSchlittermann

Joined: 2012-11-24
Posts: 4
Posted: Sat, 2012-11-24 22:36

Yep. Seems to be about that what I've outlined. But you're using the G2-API, aren't you? (I do not know that API, it's the reason for my stupid perl/shell/sql approach.)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2012-11-24 22:41
 
HeikoSchlittermann

Joined: 2012-11-24
Posts: 4
Posted: Sat, 2012-11-24 22:57

Thank you. I'd say it's solved. At least I know, what to do :)