Setting the Watermark for the album

Jul 4, 2011 at 9:50 PM

In the following code I try to set the Watermark on an existing album.

I set Watermarking to true,
Set the Watermark to the one I want from the user.GetWatermarks,
and then call album.ChangeSettings

The watermarking gets turned on, but the default SmugMug watermark is selected, not the one I set it to.
I tried album.ApplyWatermark, but that does not set the watermark for the album that just takes all the
photos in the album and sets them to the watermark. ApplyWatermark won't effect the next photos being
uploaded like setting the album to a specific watermark would.


private
void SetupAlbumWatermark(MyUser user, Album album, string watermarkName) { try { if(!string.IsNullOrEmpty(watermarkName)) { album.Watermarking = true; var listOfWatermarks = user.GetWatermarks(); foreach (var watermark in listOfWatermarks) { if(watermark.Name == watermarkName) { if(album.Watermark != watermark) { album.Watermark = watermark; } break; } } } else { album.Watermarking = false; } album.ChangeSettings(); } catch (Exception ex) { Console.WriteLine("***EXCEPTION*** See Logs"); } }

Coordinator
Jul 6, 2011 at 4:40 AM

Hi Loren.

 

I've uploaded the fix for this. Thanks for finding and reporting the issue!

 

Maria

Jul 6, 2011 at 10:06 AM
Edited Jul 6, 2011 at 10:07 AM

Maria,

    Thank you for you quick response time.  I pulled down your fix and built it.  Then cleaned my solution and rebuilt it with your new dll and it still does not work for me.  When you test it on your end you will need, at least one other Watermark then the default in order to see what I'm seeing.  Do I need to call

album.Watermark.ChangeSettings()

even if I'm not changing the watermark?

 

Thank you again for this great SmugMug platform,

-Loren

Jul 7, 2011 at 11:16 AM

Maria,

    I found the problem and fixed it Item#9881.  You changed the Value correctly in the Key Value list, but the Key was "Watermark" and needed to be "WatermarkID".  Check the newly uploaded Album.cs file and let me know if it works for you too.

 

Thanks,

-Loren

Jul 7, 2011 at 11:56 AM

Maria,

    Are you sick of me yet?  Now I can't seem to Change the watermark settings.  When I do and call

album.Watermark.ChangeSettings()

the photos that get uploaded do not get the watermark. This is what I'm trying to do:

private void SetupAlbumWatermark(MyUser user, Album album)
{
    var watermarkName = Common.GetValueFromRegistry("WatermarkName", "\\" + typeName);

    try
    {
        if(!string.IsNullOrEmpty(watermarkName))
        {
            album.Watermarking = true;
            var listOfWatermarks = user.GetWatermarks();

            foreach (var watermark in listOfWatermarks)
            {
                if(watermark.Name == watermarkName)
                {
                    if(album.Watermark != watermark)
                    {
                        album.Watermark = watermark;
                        album.Watermark.Pinned = PinnedEnum.BottomRight;
                        album.Watermark.ChangeSettings();
                    }
                    break;
                }
            }
        }
        else
        {
            album.Watermarking = false;
        }
        album.ChangeSettings();
    }
    catch (Exception ex)
    {
        Console.WriteLine("***EXCEPTION*** See Logs");
        Log("***EXCEPTION***[" + ex.TargetSite + "] " + ex.Message);
        LogBaseVars();
        Log("----------START Local Vars----------");
        Log("    watermarkName = '" + watermarkName + "'");
        Log("----------END   Local Vars----------");
    }
}

Jul 8, 2011 at 10:12 PM

Never mind I don't need to change the settings after all.  Thx

-Loren

Coordinator
Jul 12, 2011 at 5:06 PM

Hi Loren,

I've checked-in the fix you found. I'll take a look at the second problem this weekend.

Thanks for reporting the issues!

Maria

Developer
Jul 12, 2011 at 10:26 PM

Could it be that it just takes some time for SmugMug to regenerate the images with the updated watermark?

Alex