Image Block with login credentials? For a password protected members area.

biacs

Joined: 2007-11-10
Posts: 6
Posted: Fri, 2008-02-22 12:40

Is is possible to use the Image Block for previews for a gallery that requires a username and password to access? I'm trying to provide a daily, weekly, and recent album preview on the index page of the site that will be preview only (no clickthrough) but the gallery will be protected by an .htaccess file provided by CCBill. I can create a demo username and password that will authenticate with CCBill but I can not find how to pass that information in the Image Block code.

Any suggestions would be appreciated.

Thanks,
BIACS

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25953
Posted: Fri, 2008-02-22 19:34

The image block takes permissions into account before showing the item. If the user has permissions to view the item it will show in the imageblock.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
biacs

Joined: 2007-11-10
Posts: 6
Posted: Fri, 2008-02-22 21:28

So there isn't a way to prefix the command to view the imageblock information with a username and password then? What I'm attempting to do is have my index page be open to the public, have a preview section on the index page to show samples of the content inside the members area which requires a subscription to obtain a username and password. If the imageblock command cannot contain logon credentials I guess I'll have to do the previews the old fashioned way and manually update the index.php page each week.

 
macmeister

Joined: 2005-01-21
Posts: 39
Posted: Wed, 2008-02-27 20:12

I too am looking for a solution like this. Any luck?
I simply would love to pass credentials and authenticate via a URL or PHP "include" if possible. I know it's all possible, but a simple example would do wonders...

This way, on a Wordpress generic Members Only login page or otherwise, I could have a G2 RSS feed from the "Members" section of Gallery displayed. Suggestions?

 
biacs

Joined: 2007-11-10
Posts: 6
Posted: Sat, 2008-03-01 13:49

Here's what I've come up with. I know it's not the most secure but it works for my needs. My Host has a pretty simple cPanel app for protecting directories with passwords. I have password protected the Themes directory only of the gallery folder under my site (www.website.com/gallery/themes instead of the whole gallery folder) so now the imageblock works and user is prompted for credentials if they try to click on the sample shown. I have also changed the Gallery settings to force all users to use the same theme although the whole Theme directory is password protected, not just the individual theme folder.

Next step is figuring out how to use imageblock and prevent the clickthrough (especially to disable the path shown on mouse-over)

Does anyone know how to disable the click link of the image so the imageblock will be displaying samples only, they can't click to view the image?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25953
Posted: Sat, 2008-03-01 18:18

If it is the external image block you can add the switch:
&g2_link=none
I guess you would have to add the block manualy and add the switch that way.
not tested:
Example:
{g->block type="imageblock.ImageBlock" blocks="randomAlbum|randomImage" showDate=0 showOwner=1 showViews=1 showTitle=1 showHeading=0 useDefaults=0 link=none}

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
biacs

Joined: 2007-11-10
Posts: 6
Posted: Sun, 2008-03-02 14:45

Thanks floridave g2_link=none works perfect. For anyone else, I've tried getting into the gallery pages in different ways and it seems that password protecting the themes directory will work as I described above.

 
slomoman

Joined: 2007-11-01
Posts: 47
Posted: Sun, 2008-04-20 16:56

Hi FloridaAve,
I doubt that the image block module will NOT show images that are password protected.
I just tried it out, and protected a picture with a password.
Then I logged in as another user, and this picture was still shown in the imageBlock.
If I clicked on it, I was asked for the password, but I could still see the preview image in the image block, which is not nice.
Regards, Daniel

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25953
Posted: Sun, 2008-04-20 18:16

slomoman,

please file a feature request for the behavior you would like:
http://sourceforge.net/tracker/?group_id=7130&atid=357130

But some people will argue that the behavior of a prompt is the correct behavior. If you don't want the thumb to show in the imageblock use permissions.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
slomoman

Joined: 2007-11-01
Posts: 47
Posted: Wed, 2008-04-23 06:57

Hi Dave,
i will do that.
By the way, I implemented the exclusion of password protected items from the image block myself by adding this coding to
gallery2/modules/imageblock/classes/ImageBlockHelper.class
(before this statement: "list ($ret, $owner) = GalleryCoreApi::loadEntitiesById($item->getOwnerId());:".

//check if the item is directly protected by a password.
//in this case, do not show it in the image block
//not even as a preview
//(indirectly protected items are already excluded automatically)
if( $item->hasOnLoadHandler('Password') ){
continue;
}

Not perfect, but it works..

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25953
Posted: Wed, 2008-04-23 08:55

Thanks for providing a solution for others.
Can you add that bit to the codex page as well, as this might get lost in the thousands of threads.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
slomoman

Joined: 2007-11-01
Posts: 47
Posted: Wed, 2008-04-23 20:13

to which codex page?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25953
Posted: Wed, 2008-04-23 23:13
 
slomoman

Joined: 2007-11-01
Posts: 47
Posted: Sun, 2008-04-27 16:00

done

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25953
Posted: Sun, 2008-04-27 16:46

Thanks