I had an idea how to workaround this "batch watermarking issue", just not have enough gallery knowledge to validate idea/find the right spot for modification.
As I understand, currently at the upload we can mark album/items to be watermarked. So, original image will be kept intact while all derivative will get created with watermark. What happens when we clear derivative cache and then recreate them? Looks for me that, as expected, derivatives get recreated with watermark on them.
If it is true, then my idea for "workaround" would be - mark all existing items/albums as uploaded with watermark switched on and force gallery to regenerate derivatives. Not sure how difficult this "mark all exsting" would be, as I'm not sure what attribute gets filled upon upload of watermarked images. Is it db or file level? In first case it should be just a question of executing correct sql statement.
On other hand - idea looks so simple that I would wonder if somebody haven't already thought about it. Sorry if it's already been discussed here and everyone is aware it won't work
Any hint for direction where to look will be highly appreciated.
cheers,
Austris
fryfrog
Joined: 2002-10-30
Posts: 3236
Posted: Fri, 2006-03-17 12:24
Sounds like a good idea. You'd just need to figure out what the difference in the DB is, make the change and then clear the db cache as well as the thumb/resize cache. Then run the cute little build all thumbs tool. Maybe?
_________________________________ Support & Documentation || Donate to Gallery || My Website
austris
Joined: 2006-03-16
Posts: 17
Posted: Thu, 2006-03-23 00:33
thanks for your reply, fryfrog. was already giving up, but had to keep trying as you said it's in DB
g2_Derivative.g_postFilterOperations does all magic. for testing I wanted to add watermark to some existing yourimagefilename.jpg image from my gallery.
to do this:
+ add your watermark through gallery UI.
+ in update below replace <field_name> with coresponding values from g2_WatermarkImage table
UPDATE g2_Derivative SET g_postFilterOperations='composite|plugins_data/modules/watermark/<g_fileName>,<g_mimeType>,
<g_width>,<g_height>,manual,<g_xPercentage>,<g_yPercentage>' where g_derivativeType = 2 and g_derivativeSourceId = select g_id from g2_FileSystemEntity where g_pathComponent='yourimagefilename.jpg'
this will add watermark to all derivatives, but thumbnails (g_derivativeType = 1 would be thumbnail).
executed update, cleared all cache (also client side;) ), opened image and watermark was there.
still has to find out how to get all items of given album (probably using g2_ChildEntity table), to apply personalized watermarks to different albums, but not now. atm I need some sleep
cheers,
austris
P.S.
coding nice UI would be too much from me, but more friendly SQL could come as soon as I'll get some time to play with this.
sofia
Joined: 2006-03-16
Posts: 4
Posted: Wed, 2006-05-03 12:19
Wheres the .htacces you talk about? in the root folder of your site? in gallery2 folder?
Cause i ve got already an htacces for my website but theres no ligne like you mention
here's my htaccess.txt ..need I rename it to .htacces?
Quote:
## Can be commented out if causes errors, see notes above.
Options FollowSymLinks
#
# mod_rewrite in use
RewriteEngine On
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla/MamboDirectory (just / for root)
# RewriteBase /
########## Begin Standard SEF Section
## ALL (RewriteCond) lines in this section are only required if you actually
## have directories named 'content' or 'component' on your server
## If you do not have directories with these names, comment them out.
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteRule ^(content/|component/) index.php
#
########## End Standard SEF Section
########## Begin 3rd Party or Core SEF Section
#
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule (.*) index.php
#
########## End 3rd Party or Core SEF Section
What can I do?
sofia
Joined: 2006-03-16
Posts: 4
Posted: Wed, 2006-05-03 12:21
Austris, please if this work..can you explain more clearly and step by step on how to add the watermarking to all existing images... All my pictures are being stealed..
thks
Quote:
+ add your watermark through gallery UI.
+ in update below replace <field_name> with coresponding values from g2_WatermarkImage table
UPDATE g2_Derivative SET g_postFilterOperations='composite|plugins_data/modules/watermark/<g_fileName>,<g_mimeType>,
<g_width>,<g_height>,manual,<g_xPercentage>,<g_yPercentage>' where g_derivativeType = 2 and g_derivativeSourceId = select g_id from g2_FileSystemEntity where g_pathComponent='yourimagefilename.jpg'
this will add watermark to all derivatives, but thumbnails (g_derivativeType = 1 would be thumbnail).
executed update, cleared all cache (also client side;) ), opened image and watermark was there.
still has to find out how to get all items of given album (probably using g2_ChildEntity table), to apply personalized watermarks to different albums, but not now. atm I need some sleep
What the hell do you mean???
geraldmorales2
Joined: 2006-07-04
Posts: 10
Posted: Thu, 2006-07-06 12:12
Hi,
All this sounds great - but a neat, simple tutorial would help newbies... please be indulgent with us.
Gérald
JONGER
Joined: 2006-07-06
Posts: 4
Posted: Thu, 2006-07-06 14:24
geraldmorales2 wrote:
All this sounds great - but a neat, simple tutorial would help newbies... please be indulgent with us.
I'm a newbie too with the same request as geraldmorales2. Could somebody at least give it a thought?
austris
Joined: 2006-03-16
Posts: 17
Posted: Thu, 2006-07-06 22:47
well, sorry to say, but I won't have a power to code nice UI which could help you with this.
Knowing how to execute SQLs against your database is pre-requist for this, as long as I can help.
I'm using Gallery version 2.1, Watermark module 1.0.6.
Make sure you have watermark module activated.
Add watermark image using SiteAdmin->Watermarks (remember what name you gave to it; will use "my_watermark" in this example);
Now you will have to execute two SQL update statements. in both of them you have to replace:
all occurances of "g2test_" with what you have as your table prefix (e.g. "g2_" by default)
all occurances of "g_" with what you have as your column prefix
"testAlbum" (once in each statement) with your album's file system's directory name
"my_watermark" (once in each statement) with your watermark you've created before.
(I know it should be possible to put it in one SQL, but don't have enough spirit at the moment.)
When statements are executed, clear all (including derivative!) cache using http://yourhost/gallery2/lib/support URL and it should work.
N!B! just noticed one bug, appearantly in gallery's code. When you have watermark added (forget about statements below, just use watermark module) and then going to EditAlbum and selec RecreateResizedImages - all applied watermarks will be gone.
So, in our case we just have to-reapply SQLs.
austris
Joined: 2006-03-16
Posts: 17
Posted: Thu, 2006-07-06 22:47
ok, and here comes SQLs
UPDATE g2test_Derivative gDeriv, g2test_ChildEntity gChildE, g2test_Entity gEntity, g2test_FileSystemEntity gFileSysE, g2test_WatermarkImage gWaterm
SET gDeriv.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', gWaterm.g_fileName,',',gWaterm.g_mimeType,',',gWaterm.g_width,',',gWaterm.g_height,',manual,',gWaterm.g_xPercentage,',',gWaterm.g_yPercentage)
WHERE gDeriv.g_derivativeType in (2,3)
AND gDeriv.g_derivativeSourceId = gChildE.g_id
AND gChildE.g_id = gEntity.g_id
AND gEntity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND gChildE.g_parentId = gFileSysE.g_id
AND gFileSysE.g_pathComponent = 'testAlbum'
AND gWaterm.g_name='my_watermark'
UPDATE g2test_Derivative gDeriv, g2test_ChildEntity gChildE, g2test_ChildEntity gChildE2, g2test_Entity gEntity, g2test_FileSystemEntity gFileSysE, g2test_WatermarkImage gWaterm
SET gDeriv.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', gWaterm.g_fileName,',',gWaterm.g_mimeType,',',gWaterm.g_width,',',gWaterm.g_height,',manual,',gWaterm.g_xPercentage,',',gWaterm.g_yPercentage)
WHERE gDeriv.g_derivativeType in (2,3)
AND gDeriv.g_derivativeSourceId = gChildE2.g_id AND gChildE2.g_parentID=gChildE.g_id
AND gChildE.g_id = gEntity.g_id
AND gEntity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND gChildE.g_parentId = gFileSysE.g_id
AND gFileSysE.g_pathComponent = 'testAlbum'
AND gWaterm.g_name='my_watermark'
sofia
Joined: 2006-03-16
Posts: 4
Posted: Mon, 2006-07-17 10:22
Hi.
1st thanks a lot austris. very nice job.
I tried but didnt work online..
With easy php, phpmyadmin 2.6.1, and MySQL 4.1.9 no problems.
but online with phpMyAdmin 2.2.4 and MySQL 3.23.58 ive got an error : it says :
I check ive got the watermark module 1.06.
I activate it, upload an image and rename it without the extention.
Then I execute sqls ..
I change all I have to ..
Quote:
UPDATE g2_Derivative gDeriv, g2_ChildEntity gChildE, g2_Entity gEntity, g2_FileSystemEntity gFileSysE, g2_WatermarkImage gWaterm
SET gDeriv.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', gWaterm.g_fileName,',',gWaterm.g_mimeType,',',gWaterm.g_width,',',gWaterm.g_height,',manual,',gWaterm.g_xPercentage,',',gWaterm.g_yPercentage)
WHERE gDeriv.g_derivativeType in (2,3)
AND gDeriv.g_derivativeSourceId = gChildE.g_id
AND gChildE.g_id = gEntity.g_id
AND gEntity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND gChildE.g_parentId = gFileSysE.g_id
AND gFileSysE.g_pathComponent = 'artistes'
AND gWaterm.g_name='watermarkGenerations'
and heres the reply of execution...
Quote:
You have an error in your SQL syntax near 'gDeriv, g2_ChildEntity gChildE, g2_Entity gEntity, g2_FileSystemEntity gFileSysE' at line 1
an idea?
so close to the goal!!please help fot that tiny things
austris
Joined: 2006-03-16
Posts: 17
Posted: Tue, 2006-07-18 14:58
Sofia, I'm not an expert w/ neither php nor mysql, could be older version of mysql does not support table aliases.
Just checked that I'm using phpMyAdmin 2.6.1-pl3 and MySQL 4.0.15.
Try shorter version of same sql:
select gDeriv.g_id, gDeriv.g_derivativeType from g2_Derivative gDeriv
if it works then it's most likely something with syntax in your changed update statement.
if it does not work then try
select g2_Derivative.g_id, g2_Derivative.g_derivativeType from g2_Derivative
if this works then just use "g2_Derivative" instead of "g2_Derivative gDeriv" in first line and "g2_Derivative" instead of "gDeriv" in all subsequent lines (and, of course, same for other tables - g2_ChildEntity, g2_Entity, g2_FileSystemEntity, g2_WatermarkImage).
hope this helps.
cheers,
Austris
sofia
Joined: 2006-03-16
Posts: 4
Posted: Tue, 2006-07-18 15:31
ok austris thx.
So I tried the two select you gave me.
select gDeriv.g_id, gDeriv.g_derivativeType from g2_Derivative gDeriv
is ok..so what can I do?
Sorry but I dint understand what you meaned and what I have to do..
Please can you help me to write the good sql syntax?
thanks a lot
austris
Joined: 2006-03-16
Posts: 17
Posted: Tue, 2006-07-18 16:49
well, if it works then I have no idea why update did not work.
What about:
select * from g2_Derivative gDeriv, g2_ChildEntity gChildE, g2_Entity gEntity, g2_FileSystemEntity gFileSysE, g2_WatermarkImage gWaterm
if it also works then I don't know. try to repeat copy&paste of update statement. just guessing - maybe some weird symbol instead of space before gDeriv.
and, in worst case, try to use just table names w/out aliases as I wrote before.
Austris
P.S.
here would be example of one of updates where tale aliases replaces with table names (hope I did not mistype anywhere):
UPDATE g2_Derivative, g2_ChildEntity, g2_Entity, g2_FileSystemEntity, g2_WatermarkImage
SET g2_Derivative.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', g2_WatermarkImage.g_fileName,',',g2_WatermarkImage.g_mimeType,',',g2_WatermarkImage.g_width,',',g2_WatermarkImage.g_height,',manual,',g2_WatermarkImage.g_xPercentage,',',g2_WatermarkImage.g_yPercentage)
WHERE g2_Derivative.g_derivativeType in (2,3)
AND g2_Derivative.g_derivativeSourceId = g2_ChildEntity.g_id
AND g2_ChildEntity.g_id = g2_Entity.g_id
AND g2_Entity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND g2_ChildEntity.g_parentId = g2_FileSystemEntity.g_id
AND g2_FileSystemEntity.g_pathComponent = 'artistes'
AND g2_WatermarkImage.g_name='watermarkGenerations'
MichaelH99
Joined: 2006-08-02
Posts: 2
Posted: Wed, 2006-08-02 20:18
I've tried all the SQL scripts here and while I can verify that data is being added to the g_postFilterOperations row, my watermark isn't showing up at all. I don't get any sql errors.
Anyone have any new reliable methods for globally changing a watermark? The scripts I was running are:
UPDATE g2_Derivative, g2_ChildEntity, g2_Entity, g2_FileSystemEntity,g2_WatermarkImage
SET g2_Derivative.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', g2_WatermarkImage.g_fileName,',',g2_WatermarkImage.g_mimeType,',',g2_WatermarkImage.g_width,',',g2_WatermarkImage.g_height,',manual,',g2_WatermarkImage.g_xPercentage,',',g2_WatermarkImage.g_yPercentage)
WHERE g2_Derivative.g_derivativeType in (2,3)
AND g2_Derivative.g_derivativeSourceId = g2_ChildEntity.g_id
AND g2_Entity.g_id = g2_Entity.g_id
AND g2_Entity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND g2_ChildEntity.g_parentId = g2_FileSystemEntity.g_id
AND g2_FileSystemEntity.g_pathComponent = 'holography'
AND g2_WatermarkImage.g_name='WatermarkLight'
UPDATE g2_Derivative, g2_ChildEntity, g2_Entity, g2_FileSystemEntity, g2_WatermarkImage
SET g2_Derivative.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', g2_WatermarkImage.g_fileName,',',g2_WatermarkImage.g_mimeType,',',g2_WatermarkImage.g_width,',',g2_WatermarkImage.g_height,',manual,',g2_WatermarkImage.g_xPercentage,',',g2_WatermarkImage.g_yPercentage)
WHERE g2_Derivative.g_derivativeType in (2,3)
AND g2_Derivative.g_derivativeSourceId = g2_ChildEntity.g_id
AND g2_Entity.g_id = g2_Entity.g_id
AND g2_Entity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND g2_ChildEntity.g_parentId = g2_FileSystemEntity.g_id
AND g2_FileSystemEntity.g_pathComponent = 'holography'
AND g2_WatermarkImage.g_name='WatermarkLight'
austris
Joined: 2006-03-16
Posts: 17
Posted: Thu, 2006-08-10 07:54
MichaelH99 - if postFilterOperations got updated and watermarks are still missing then my guess would be that you haven't cleared cache (including previously created derivative images)
MichaelH99
Joined: 2006-08-02
Posts: 2
Posted: Thu, 2006-08-10 16:10
I'm not sure what else I need to clear beyond doing the admin "Build all thumbnails/resizes" and "Delete database cache"
Is there some other cache I need to clean out?
austris
Joined: 2006-03-16
Posts: 17
Posted: Thu, 2006-08-10 17:11
1) make sure "Build all thumbnails/resizes" did not clear postoperation field. That's what I noticed in my installation.
It actually cleared the postoperation field in both cases - when it originally was filled by watermark module and when filled by my sql.
2) "Delete database cache" definetly won't help. Most expensive way (clearing _all_ derivatives) would be going to http://your host/gallery2/lib/support/ then CacheMaintenance and check "Thumbnails and resizes". Or delete content of galerydata/cache/derivative folder.
Does anybody know if the feature is now implemented or if it was closed due to other reasons?
Thanks for your help
Waldorf
fryfrog
Joined: 2002-10-30
Posts: 3236
Posted: Sat, 2006-08-12 15:13
It was closed because the feature has been implemented in current cvs and will be one of the many new features in G2.2 when it is released. If you wanted to check it out, you could grab a copy via svn or nightly build.
_________________________________ Support & Documentation || Donate to Gallery || My Website
carl2990
Joined: 2007-04-11
Posts: 15
Posted: Sun, 2007-10-28 21:11
i have gallery version 2.2.1 and it isnt included in mine, or am i just missing it somewhere?
n/m was just me being dumb, found it.
lexthoonen
Joined: 2006-11-21
Posts: 40
Posted: Fri, 2007-11-09 17:18
f**k i must be blind. I just upgraded to the latest version as i was still using 2.1, but I can't find it nowhere. At 'watermark' (almost down at the bottom of the list at site admin) nothing seems to have changed since 2.1. So I looked elsewhere but I just don't see it. Neither at the front end. I mean, I have a gallery with lots of unwatermarked images, I was hoping this new feature would enable me to just tell gallery2 to watermark all images found in the root album and all subalbums.... Can anyone point me in the right direction? Thanks!
carl2990
Joined: 2007-04-11
Posts: 15
Posted: Sun, 2007-11-11 15:56
lexthoonen wrote:
f**k i must be blind. I just upgraded to the latest version as i was still using 2.1, but I can't find it nowhere. At 'watermark' (almost down at the bottom of the list at site admin) nothing seems to have changed since 2.1. So I looked elsewhere but I just don't see it. Neither at the front end. I mean, I have a gallery with lots of unwatermarked images, I was hoping this new feature would enable me to just tell gallery2 to watermark all images found in the root album and all subalbums.... Can anyone point me in the right direction? Thanks!
edit album, look accross the top at the tabs, general...album...theme....watermark
click watermark, select the watermark you want, move it to the right place, click apply watermark
lexthoonen
Joined: 2006-11-21
Posts: 40
Posted: Tue, 2007-11-13 23:38
carl2990 wrote:
edit album, look accross the top at the tabs, general...album...theme....watermark
Hi Carl, thanks for your reply!
However, I can see 'general, album and theme' (and 'custom fields' (i think it's called)), but no 'watermark' here... Yet I've got the latest version of Gallery2. Could it be a theme thing? Seems unlikely, but I'll check that out anyway right now.
lexthoonen
Joined: 2006-11-21
Posts: 40
Posted: Fri, 2007-11-16 18:58
Hmmm, I've set it all to th e'classic' theme, and I'm running the latest gallery2 version, but still, there's only 'general, album, theme and custom fields'. Is it a bug or am I missing something? Thanks for any reply!
Posts: 32509
no, that's the batch watermarking feature request on http://gallery.menalto.com/sfvote all about.
feel free to submit a patch
Posts: 7
I've a tempory solution. With the module or url rewriting, ( Apache platform ).
Choose watermark for external link in watermark page.
You must activate url rewriting for watermarking external photo. After Go to you edit .htaccess and comment or delete this line :
RewriteCond %{HTTP_REFERER} !://galerie\.gerpho\.com/ [NC]
Now you have :
RewriteCond %{QUERY_STRING} view=core.DownloadItem
RewriteCond %{QUERY_STRING} itemId=([0-9]+)
#RewriteCond %{HTTP_REFERER} !://galerie\.gerpho\.com/ [NC]
RewriteRule . /main.php?g2_view=watermark.DownloadItem&g2_itemId=%1 [L]
And All photo have watermark.!!!!
Posts: 14
My .htaccess file doesn't have this line. It shows:
RewriteCond %{THE_REQUEST} \ /gallery2/d/([0-9]+)-([0-9]+)/([^\/]+)(\?.|\ .)
RewriteCond %{REQUEST_FILENAME} !main\.php
RewriteRule . /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2 [QSA,L]
How can I modify this to get the watermarks on all my images?
I tried just changing the last line above to
RewriteRule . /gallery2/main.php?g2_view=watermark.DownloadItem&g2_itemId=%1&g2_serialNumber=%2 [QSA,L]
But that didn't do the trick...
Thanks in advance!
Posts: 17
I had an idea how to workaround this "batch watermarking issue", just not have enough gallery knowledge to validate idea/find the right spot for modification.
As I understand, currently at the upload we can mark album/items to be watermarked. So, original image will be kept intact while all derivative will get created with watermark. What happens when we clear derivative cache and then recreate them? Looks for me that, as expected, derivatives get recreated with watermark on them.
If it is true, then my idea for "workaround" would be - mark all existing items/albums as uploaded with watermark switched on and force gallery to regenerate derivatives. Not sure how difficult this "mark all exsting" would be, as I'm not sure what attribute gets filled upon upload of watermarked images. Is it db or file level? In first case it should be just a question of executing correct sql statement.
On other hand - idea looks so simple that I would wonder if somebody haven't already thought about it. Sorry if it's already been discussed here and everyone is aware it won't work
Any hint for direction where to look will be highly appreciated.
cheers,
Austris
Posts: 3236
Sounds like a good idea. You'd just need to figure out what the difference in the DB is, make the change and then clear the db cache as well as the thumb/resize cache. Then run the cute little build all thumbs tool. Maybe?
_________________________________
Support & Documentation || Donate to Gallery || My Website
Posts: 17
thanks for your reply, fryfrog. was already giving up, but had to keep trying as you said it's in DB
g2_Derivative.g_postFilterOperations does all magic. for testing I wanted to add watermark to some existing yourimagefilename.jpg image from my gallery.
to do this:
+ add your watermark through gallery UI.
+ in update below replace <field_name> with coresponding values from g2_WatermarkImage table
UPDATE g2_Derivative SET g_postFilterOperations='composite|plugins_data/modules/watermark/<g_fileName>,<g_mimeType>,
<g_width>,<g_height>,manual,<g_xPercentage>,<g_yPercentage>' where g_derivativeType = 2 and g_derivativeSourceId = select g_id from g2_FileSystemEntity where g_pathComponent='yourimagefilename.jpg'
this will add watermark to all derivatives, but thumbnails (g_derivativeType = 1 would be thumbnail).
executed update, cleared all cache (also client side;) ), opened image and watermark was there.
still has to find out how to get all items of given album (probably using g2_ChildEntity table), to apply personalized watermarks to different albums, but not now. atm I need some sleep
cheers,
austris
P.S.
coding nice UI would be too much from me, but more friendly SQL could come as soon as I'll get some time to play with this.
Posts: 4
Wheres the .htacces you talk about? in the root folder of your site? in gallery2 folder?
Cause i ve got already an htacces for my website but theres no ligne like you mention
here's my htaccess.txt ..need I rename it to .htacces?
What can I do?
Posts: 4
Austris, please if this work..can you explain more clearly and step by step on how to add the watermarking to all existing images... All my pictures are being stealed..
thks
What the hell do you mean???
Posts: 10
Hi,
All this sounds great - but a neat, simple tutorial would help newbies... please be indulgent with us.
Gérald
Posts: 4
I'm a newbie too with the same request as geraldmorales2. Could somebody at least give it a thought?
Posts: 17
well, sorry to say, but I won't have a power to code nice UI which could help you with this.
Knowing how to execute SQLs against your database is pre-requist for this, as long as I can help.
I'm using Gallery version 2.1, Watermark module 1.0.6.
Make sure you have watermark module activated.
Add watermark image using SiteAdmin->Watermarks (remember what name you gave to it; will use "my_watermark" in this example);
Now you will have to execute two SQL update statements. in both of them you have to replace:
all occurances of "g2test_" with what you have as your table prefix (e.g. "g2_" by default)
all occurances of "g_" with what you have as your column prefix
"testAlbum" (once in each statement) with your album's file system's directory name
"my_watermark" (once in each statement) with your watermark you've created before.
(I know it should be possible to put it in one SQL, but don't have enough spirit at the moment.)
When statements are executed, clear all (including derivative!) cache using http://yourhost/gallery2/lib/support URL and it should work.
N!B! just noticed one bug, appearantly in gallery's code. When you have watermark added (forget about statements below, just use watermark module) and then going to EditAlbum and selec RecreateResizedImages - all applied watermarks will be gone.
So, in our case we just have to-reapply SQLs.
Posts: 17
ok, and here comes SQLs
UPDATE g2test_Derivative gDeriv, g2test_ChildEntity gChildE, g2test_Entity gEntity, g2test_FileSystemEntity gFileSysE, g2test_WatermarkImage gWaterm
SET gDeriv.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', gWaterm.g_fileName,',',gWaterm.g_mimeType,',',gWaterm.g_width,',',gWaterm.g_height,',manual,',gWaterm.g_xPercentage,',',gWaterm.g_yPercentage)
WHERE gDeriv.g_derivativeType in (2,3)
AND gDeriv.g_derivativeSourceId = gChildE.g_id
AND gChildE.g_id = gEntity.g_id
AND gEntity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND gChildE.g_parentId = gFileSysE.g_id
AND gFileSysE.g_pathComponent = 'testAlbum'
AND gWaterm.g_name='my_watermark'
UPDATE g2test_Derivative gDeriv, g2test_ChildEntity gChildE, g2test_ChildEntity gChildE2, g2test_Entity gEntity, g2test_FileSystemEntity gFileSysE, g2test_WatermarkImage gWaterm
SET gDeriv.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', gWaterm.g_fileName,',',gWaterm.g_mimeType,',',gWaterm.g_width,',',gWaterm.g_height,',manual,',gWaterm.g_xPercentage,',',gWaterm.g_yPercentage)
WHERE gDeriv.g_derivativeType in (2,3)
AND gDeriv.g_derivativeSourceId = gChildE2.g_id AND gChildE2.g_parentID=gChildE.g_id
AND gChildE.g_id = gEntity.g_id
AND gEntity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND gChildE.g_parentId = gFileSysE.g_id
AND gFileSysE.g_pathComponent = 'testAlbum'
AND gWaterm.g_name='my_watermark'
Posts: 4
Hi.
1st thanks a lot austris. very nice job.
I tried but didnt work online..
With easy php, phpmyadmin 2.6.1, and MySQL 4.1.9 no problems.
but online with phpMyAdmin 2.2.4 and MySQL 3.23.58 ive got an error : it says :
I check ive got the watermark module 1.06.
I activate it, upload an image and rename it without the extention.
Then I execute sqls ..
I change all I have to ..
and heres the reply of execution...
an idea?
so close to the goal!!please help fot that tiny things
Posts: 17
Sofia, I'm not an expert w/ neither php nor mysql, could be older version of mysql does not support table aliases.
Just checked that I'm using phpMyAdmin 2.6.1-pl3 and MySQL 4.0.15.
Try shorter version of same sql:
select gDeriv.g_id, gDeriv.g_derivativeType from g2_Derivative gDeriv
if it works then it's most likely something with syntax in your changed update statement.
if it does not work then try
select g2_Derivative.g_id, g2_Derivative.g_derivativeType from g2_Derivative
if this works then just use "g2_Derivative" instead of "g2_Derivative gDeriv" in first line and "g2_Derivative" instead of "gDeriv" in all subsequent lines (and, of course, same for other tables - g2_ChildEntity, g2_Entity, g2_FileSystemEntity, g2_WatermarkImage).
hope this helps.
cheers,
Austris
Posts: 4
ok austris thx.
So I tried the two select you gave me.
select gDeriv.g_id, gDeriv.g_derivativeType from g2_Derivative gDeriv
is ok..so what can I do?
Sorry but I dint understand what you meaned and what I have to do..
Please can you help me to write the good sql syntax?
thanks a lot
Posts: 17
well, if it works then I have no idea why update did not work.
What about:
select * from g2_Derivative gDeriv, g2_ChildEntity gChildE, g2_Entity gEntity, g2_FileSystemEntity gFileSysE, g2_WatermarkImage gWaterm
if it also works then I don't know. try to repeat copy&paste of update statement. just guessing - maybe some weird symbol instead of space before gDeriv.
and, in worst case, try to use just table names w/out aliases as I wrote before.
Austris
P.S.
here would be example of one of updates where tale aliases replaces with table names (hope I did not mistype anywhere):
UPDATE g2_Derivative, g2_ChildEntity, g2_Entity, g2_FileSystemEntity, g2_WatermarkImage
SET g2_Derivative.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', g2_WatermarkImage.g_fileName,',',g2_WatermarkImage.g_mimeType,',',g2_WatermarkImage.g_width,',',g2_WatermarkImage.g_height,',manual,',g2_WatermarkImage.g_xPercentage,',',g2_WatermarkImage.g_yPercentage)
WHERE g2_Derivative.g_derivativeType in (2,3)
AND g2_Derivative.g_derivativeSourceId = g2_ChildEntity.g_id
AND g2_ChildEntity.g_id = g2_Entity.g_id
AND g2_Entity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND g2_ChildEntity.g_parentId = g2_FileSystemEntity.g_id
AND g2_FileSystemEntity.g_pathComponent = 'artistes'
AND g2_WatermarkImage.g_name='watermarkGenerations'
Posts: 2
I've tried all the SQL scripts here and while I can verify that data is being added to the g_postFilterOperations row, my watermark isn't showing up at all. I don't get any sql errors.
Anyone have any new reliable methods for globally changing a watermark? The scripts I was running are:
UPDATE g2_Derivative, g2_ChildEntity, g2_Entity, g2_FileSystemEntity,g2_WatermarkImage
SET g2_Derivative.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', g2_WatermarkImage.g_fileName,',',g2_WatermarkImage.g_mimeType,',',g2_WatermarkImage.g_width,',',g2_WatermarkImage.g_height,',manual,',g2_WatermarkImage.g_xPercentage,',',g2_WatermarkImage.g_yPercentage)
WHERE g2_Derivative.g_derivativeType in (2,3)
AND g2_Derivative.g_derivativeSourceId = g2_ChildEntity.g_id
AND g2_Entity.g_id = g2_Entity.g_id
AND g2_Entity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND g2_ChildEntity.g_parentId = g2_FileSystemEntity.g_id
AND g2_FileSystemEntity.g_pathComponent = 'holography'
AND g2_WatermarkImage.g_name='WatermarkLight'
UPDATE g2_Derivative, g2_ChildEntity, g2_Entity, g2_FileSystemEntity, g2_WatermarkImage
SET g2_Derivative.g_postFilterOperations=concat('composite|plugins_data/modules/watermark/', g2_WatermarkImage.g_fileName,',',g2_WatermarkImage.g_mimeType,',',g2_WatermarkImage.g_width,',',g2_WatermarkImage.g_height,',manual,',g2_WatermarkImage.g_xPercentage,',',g2_WatermarkImage.g_yPercentage)
WHERE g2_Derivative.g_derivativeType in (2,3)
AND g2_Derivative.g_derivativeSourceId = g2_ChildEntity.g_id
AND g2_Entity.g_id = g2_Entity.g_id
AND g2_Entity.g_entityType in ('GalleryPhotoItem','GalleryDerivativeImage')
AND g2_ChildEntity.g_parentId = g2_FileSystemEntity.g_id
AND g2_FileSystemEntity.g_pathComponent = 'holography'
AND g2_WatermarkImage.g_name='WatermarkLight'
Posts: 17
MichaelH99 - if postFilterOperations got updated and watermarks are still missing then my guess would be that you haven't cleared cache (including previously created derivative images)
Posts: 2
I'm not sure what else I need to clear beyond doing the admin "Build all thumbnails/resizes" and "Delete database cache"
Is there some other cache I need to clean out?
Posts: 17
1) make sure "Build all thumbnails/resizes" did not clear postoperation field. That's what I noticed in my installation.
It actually cleared the postoperation field in both cases - when it originally was filled by watermark module and when filled by my sql.
2) "Delete database cache" definetly won't help. Most expensive way (clearing _all_ derivatives) would be going to http://your host/gallery2/lib/support/ then CacheMaintenance and check "Thumbnails and resizes". Or delete content of galerydata/cache/derivative folder.
Hope it helps,
Austris
Posts: 4
Hi fols,
the feature request "[G2] bulk watermarking" was closed yesterday.
Does anybody know if the feature is now implemented or if it was closed due to other reasons?
Thanks for your help
Waldorf
Posts: 3236
It was closed because the feature has been implemented in current cvs and will be one of the many new features in G2.2 when it is released. If you wanted to check it out, you could grab a copy via svn or nightly build.
_________________________________
Support & Documentation || Donate to Gallery || My Website
Posts: 15
i have gallery version 2.2.1 and it isnt included in mine, or am i just missing it somewhere?
n/m was just me being dumb, found it.
Posts: 40
f**k i must be blind. I just upgraded to the latest version as i was still using 2.1, but I can't find it nowhere. At 'watermark' (almost down at the bottom of the list at site admin) nothing seems to have changed since 2.1. So I looked elsewhere but I just don't see it. Neither at the front end. I mean, I have a gallery with lots of unwatermarked images, I was hoping this new feature would enable me to just tell gallery2 to watermark all images found in the root album and all subalbums.... Can anyone point me in the right direction? Thanks!
Posts: 15
edit album, look accross the top at the tabs, general...album...theme....watermark
click watermark, select the watermark you want, move it to the right place, click apply watermark
Posts: 40
Hi Carl, thanks for your reply!
However, I can see 'general, album and theme' (and 'custom fields' (i think it's called)), but no 'watermark' here... Yet I've got the latest version of Gallery2. Could it be a theme thing? Seems unlikely, but I'll check that out anyway right now.
Posts: 40
Hmmm, I've set it all to th e'classic' theme, and I'm running the latest gallery2 version, but still, there's only 'general, album, theme and custom fields'. Is it a bug or am I missing something? Thanks for any reply!