Random Image won't show

wamfgcom

Joined: 2013-08-28
Posts: 24
Posted: Thu, 2013-09-12 21:14

Hello,

I have recently installed Gallery3 and it is working nicely! :)
Way to go guys, great script!

I have the random image feature in place and it also works.

I'd like to place that same random image on another internal site page but cannot get it to work. I've tried file_get_contents, include and readfile and both local and full urls. Both of the latter work in other places on the site (with other scripts) with full urls.

My entire gallery and the page I wish to place the random image on are within a protected members area. mysite.com/members/gallery3/... - is this my problem?

I'm also attempting to place a php script into one of the code boxes with include_once but it either breaks the pages code or blanks out.

I'm so close to finished, PHP is not my native language, hoping someone can point me in the right direction or tell me what I'm doing wrong :(

Thanks!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-09-12 22:01

Moved to G3 section form G2 section.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-09-12 22:02
Quote:
within a protected members area

that would do it.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-09-12 22:08
 
wamfgcom

Joined: 2013-08-28
Posts: 24
Posted: Thu, 2013-09-12 23:03

Sorry about the miss location and thanks for the quick reply!

I had read some forum posts about members areas but thought that might have been referring to external access, it was hard to tell. Where as mine is all within the members area. Thanks for clearing that up.

Is there any other way to accomplish this?
Is the same restriction preventing me from implementing my own php script within gallery3's pages?

Thanks so much!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-09-12 23:12
Quote:
Is there any other way to accomplish this?

So you want the items not to show (restriction) but you want them to show? How is this 'restriction' implemented? Gallery permissions, .htaccess, or some other method?

Quote:
Is the same restriction preventing me from implementing my own php script within gallery3's pages?

Remove the restriction and find out.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
wamfgcom

Joined: 2013-08-28
Posts: 24
Posted: Thu, 2013-09-12 23:48

Not sure I've explained myself very well, sorry.

I have a members only site which is controlled by htpasswd to access the "members" folder. Everything I want to do, the main gallery3 folder, all albums, images etc. are within that protected area.

I would like to show a random image on:

mysite.com/members/mainpage.php

from

mysite.com/members/gallery3/

if possible ;)

wamfgcom

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-09-13 13:32

try the http://codex.galleryproject.org/Gallery3:Modules:randimg module.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
wamfgcom

Joined: 2013-08-28
Posts: 24
Posted: Fri, 2013-09-13 15:58

Appreciate the reply Dave,

I am using the randimg module successfully within the gallery but as I pointed out and the reason for my post is that it will not work when attempting to use it on any other page not within gallery3's folder. You suggested above this is due to my entire site being within a protected htpasswd member's area.

Now I'm really confused, should randimg be able to do this, or not, and if so would you have any idea as to why it will not work for my site?

Thanks

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-09-13 17:12

I don't know. I've not tested it with .htaccess protection. You could temporarily remove the .htaccess protection to test.
That would confirm it is that or not as it does work for me:
http://floridave.com/rand.php

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
wamfgcom

Joined: 2013-08-28
Posts: 24
Posted: Sat, 2013-09-14 03:57

Good call Dave.

I removed my member's directory htaccess file and the random image worked fine.
Of course I couldn't leave it like that, any work-a-round that you know of?

Thanks,
wamfgcom

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2013-09-14 15:50

I'm not sure and I can't even test but google says:

     <?php
         $imglink = file_get_contents("http://EXAMPLE.COM/gallery3/index.php/randimg", "r");
         echo "$imglink";
     ?>

to

     <?php
         $imglink = file_get_contents("http://username:password@EXAMPLE.COM/gallery3/index.php/randimg", "r");
         echo "$imglink";
     ?>

I guess you would need to create a generic user and password. Sort of defeats the security though.
Try setting the http auth to allow the server to see the contence without the http auth.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team