Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

WaterMarkImage
sanilsanta
#1 Posted : Wednesday, 18 May 2011 12:29:14 PM(UTC)
Rank: Member

Joined: 18/05/2011(UTC)
Posts: 6

Hi,
i am trying to change the water mark image dynamically, like i am trying to introduce an interface where admin can upload new watermarkimage which will overwrite the old one, but once i run the application i am not able to delete the watermark image, it says this file is used by some other process, after i reset the webserver i am able to overwrite the water mark image but it only work until i call the watermark asmx service, when i debug this has some this to do with this line located at watermark.cs around #210 line

// Assign the WatermarkImage property. We clone it and dispose of the first instance to release the lock on the file.
// If we don't do this, the watermark image is locked for the lifetime of the application.

_watermarkImage = System.Drawing.Image.FromFile(_imagePath);
System.Drawing.Image watermarkImageCopy = (System.Drawing.Image)_watermarkImage.Clone();
_watermarkImage.Dispose();
_watermarkImage = watermarkImageCopy;

it already says we have to dispose otherwise the file will be locked for lifetime of the application but i guess its not working somehow.
if i do something like add extra line watermarkImageCopy.Dispose() the lock is released but
i get error in GetWatermarkImage(int recipientImageWidth, int recipientImageHeight)
the first two lines

int watermarkWidth = this.WatermarkImageWidth;
int watermarkHeight = this.WatermarkImageHeight;

this.WatermarkImageWidth and this.WatermarkImageHeight says Parameter is not valid.



can you please help me out

Thanks
Sanil
Roger Martin
#2 Posted : Wednesday, 18 May 2011 12:36:02 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

I can confirm the same behavior under .NET 4 on my system. That's a bummer because I had put in that code specifically to avoid the locking problem, and it was working at one time. I don't know if this is new to .NET 4 or what.

I'll add this to my bug tracker but I can't get to it right away. If you end up solving this please share the solution and I'll get it in the next release.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
sanilsanta
#3 Posted : Wednesday, 18 May 2011 2:08:32 PM(UTC)
Rank: Member

Joined: 18/05/2011(UTC)
Posts: 6

Hi,
Thanks for you reply, yes i am using .net 4. i solved the issue using the below code.
/* **commented Sanil** */
/*_watermarkImage = System.Drawing.Image.FromFile(_imagePath);
System.Drawing.Image watermarkImageCopy = (System.Drawing.Image)_watermarkImage.Clone();
_watermarkImage.Dispose();
_watermarkImage = watermarkImageCopy;*/
/* **Commented Sanil** */
_watermarkImage = new Bitmap(System.Drawing.Image.FromFile(_imagePath));

Can you please comment on the Bitmap logic i used, will this be okay. i am not sure abt the other version but in .net 4 it seems to solve the problem

Thanks
Sanil

Roger Martin
#4 Posted : Wednesday, 18 May 2011 3:55:14 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

I can confirm your solution seems to work and doesn't hold a lock, but it worries me that the Image object is not disposed. It may not be important, but I am modifying the code to use this:

Code:
using (System.Drawing.Image img = System.Drawing.Image.FromFile(_imagePath))
{
 _watermarkImage = new Bitmap(img);
}


Unless any issues appear, this is the code that will appear in the next release.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
sanilsanta
#5 Posted : Wednesday, 18 May 2011 3:58:58 PM(UTC)
Rank: Member

Joined: 18/05/2011(UTC)
Posts: 6

Great, Thanks for your feed back. i will apply this to mine to.

Thanks
Sanil
sanilsanta
#6 Posted : Thursday, 19 May 2011 7:07:19 AM(UTC)
Rank: Member

Joined: 18/05/2011(UTC)
Posts: 6

Hi,

when i was testing i see the paging is not working properly for search, so i checked the live server http://www.galleryserverpro.com i can see the same issue there

for example please try to search for planet it will redirect to below link
http://www.galleryserver...=1593&search=planet

but paging is not working there please try, i guess may be something to do with name of album and photos name inside tht is similar

Can you please direct me what to do

Thanks
Sanil
Roger Martin
#7 Posted : Thursday, 19 May 2011 7:49:30 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

You are right - this is another bug introduced in 2.4.7. The fix is to disable paging for the search page. In the source code version of GSP, open Website\gs\controls\thumbnailview.ascx.cs in an editor like Visual Studio. Look for this property:

Code:
public bool PagingEnabled
{
 get
 {
  if (!this._pagingEnabled.HasValue)
  {
   int pageSize = this.GalleryPage.GallerySettings.PageSize;
   int objectCount = (this.GalleryObjectsDataSource ?? this.GalleryPage.GetAlbum().GetChildGalleryObjects(false, this.GalleryPage.IsAnonymousUser)).Count;

   this._pagingEnabled = ((pageSize > 0) && (objectCount > pageSize));
  }

  return this._pagingEnabled.Value;
 }
}


Change it to this:

Code:
public bool PagingEnabled
{
 get
 {
  if (this.GalleryPage.PageId == PageId.search)
  {
   return false;
  }

  if (!this._pagingEnabled.HasValue)
  {
   int pageSize = this.GalleryPage.GallerySettings.PageSize;
   int objectCount = (this.GalleryObjectsDataSource ?? this.GalleryPage.GetAlbum().GetChildGalleryObjects(false, this.GalleryPage.IsAnonymousUser)).Count;

   this._pagingEnabled = ((pageSize > 0) && (objectCount > pageSize));
  }

  return this._pagingEnabled.Value;
 }
}


Those of you using the compiled version of GSP: The only workaround is to disable paging until the next release. You can do this on the Album page in the site admin area.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
sanilsanta
#8 Posted : Friday, 20 May 2011 4:28:24 AM(UTC)
Rank: Member

Joined: 18/05/2011(UTC)
Posts: 6

Hi,
Thanks for your last reply, i like to know something, i have a user named test i am using this user to create public albums, after creating albums i created new users named test1,test2,...test* how will i make test1 to test* to see all the public album created by test. for now it says insufficient permission for test1, should i add newly created users to any specific roles so he will be able to view other peoples public albums

Thanks
Sanil
sanilsanta
#9 Posted : Friday, 20 May 2011 5:44:34 AM(UTC)
Rank: Member

Joined: 18/05/2011(UTC)
Posts: 6

Hi,
just to update i created two roles view and create, for viewrole i enabled
View albums / objects and for the create role i enabled add album,create album stuffs

1) Can we do something like for view role, this user can view all albums under the main root
and for the create role user should be able to create new albums but not on other users albums

2) one more thing i would like to ask is i create an album for user test inside the main album
i create another one for example the structure will be like Allalbum->albumuserparent->albumuserchild but when i login it redirects me to albumchild instead of albumparent bcz of this i am not able to create new album under the albumuserparent. can you also please help with this

3) is ther any way to hide empty albums

Thanks
Sanil
Roger Martin
#10 Posted : Friday, 20 May 2011 7:58:38 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,300
Location: Fort Atkinson, WI

I am having a hard time following your questions, so let me make a couple points:

* Read up on roles in the Admin Guide.

* If you can't see an album (like useralbumparent in your example), that means the user doesn't have permission to view the album. You'll have to give the user permission - no way around that.

* The only way to hide empty albums is by using the privacy flag to hide albums from anonymous users, and using roles to hide albums from authenticated users. A related feature is that you can prevent user albums from being created for each user by unchecking the option 'Automatically create user album the first time a user logs on to the gallery' on the User Settings page. That can help prevent a bunch of empty user albums.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
Rss Feed  Atom Feed
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.