[SOLVED] External Random Image not Working with latest CVS

hodderpei

Joined: 2005-02-18
Posts: 4
Posted: Fri, 2005-02-18 15:57

Bug: External Random Image not Working with latest CVS

It works with alpha 4 but when i upgrade to the latest is breaks. No image is displayed on my website and there is no error code.
----

Code used:
<?php @readfile ('http://www.mysite.com/gallery2/main.php?g2_view=imageblock:External&g2_blocks=randomImage&g2_show=none'); ?>

Server info
Operating system = freebsd
Kernel = 4.8-STABLE
Machine = i386
Processor type = i386

Perl info
Perl location = /usr/bin/perl
Perl version = 5.008003
Locations of Perl libraries = /usr/local/lib/perl5/5.8.3/i386-freebsd /usr/local/lib/perl5/5.8.3 /usr/local/lib/perl5/site_perl/5.8.3/i386-freebsd /usr/local/lib/perl5/site_perl/5.8.3 /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .

Perl libraries installed
Library CGI v3.01 installed
The library mod_perl is not installed
Library www-perl v5.69 installed
Library LWP::Parallel v2.56 installed
Library SOAP::Lite v0.55 installed
Library DBI v1.37 installed
Library DBD::mysql v2.0419 installed
Library URI v1.23 installed
Library Digest::MD5 v2.33 installed
Library Crypt::SSLeay v0.51 installed
Library Net::SSLeay.pm v1.23 installed

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-02-18 18:49

going directly to the url in your readfile() call appears to work fine...
try removing the @ from in front of readfile.. the @ suppresses error messages from php.. since it isn't working you'll want to see if php can provide any helpful info.

 
hodderpei

Joined: 2005-02-18
Posts: 4
Posted: Fri, 2005-02-18 19:35

Warning: readfile(): URL file-access is disabled in the server configuration in /usr/www/users/hodderpe/wp-content/themes/Manji2/sidebar.php on line 44

Warning: readfile(http://www.mysite.com/gallery2/main.php?g2_view=imageblock:External&g2_blocks=randomImage&g2_show=none): failed to open stream: no suitable wrapper could be found in /usr/www/users/hodderpe/wp-content/themes/Manji2/sidebar.php on line 44

????? Is this a server issue?

Thanks

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-02-18 19:48

yes it is, got the same on my server.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-02-18 19:48

yes, your php is not allowing you to use readfile() to access urls.
check php.net/manual to find how to enable this, or ask your webhost if you're using one..

 
hodderpei

Joined: 2005-02-18
Posts: 4
Posted: Sat, 2005-02-19 03:26

Sorry my mistake... I switched hosts and this one had it disabled. while my previous did not. Everything is working now though! Thanks!

 
hodderpei

Joined: 2005-02-18
Posts: 4
Posted: Sat, 2005-02-19 03:28

How it works: I did this for my host (Pair)

created a .htaccess file and placed it in the same directory as the file I was trying to load the image in. I added the following line to the .htaccess file:

php_flag allow_url_fopen on

Thats it! Worked for my host maybe others too.

 
Flatfoot

Joined: 2009-12-07
Posts: 17
Posted: Tue, 2009-12-15 19:13

I can't get this external link to a random image to work at all!!! I added the code to my page. I get absolutely NOTHING! Just a blank page!

I can copy another user's link and see his image, but I get nothing.

I added the <link rel="stylesheet" href="http://www.chrisibbeson.com/gallery2/main.php?g2_controller=imageblock.ExternalCSS&amp;g2_frames=wood"/> line in the <head> section.

Here is the page:
http://www.chrisibbeson.com/U/RandomImage.php

Here is the link in the page (I copied it directly from the site admin image block page).
<?php readfile('http://www.chrisibbeson.com/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>

Try it yourself - copy that link into a page. You'll get NOTHING!!

What's going on? I can see other people's pictures cy copying their links, but I can't see my own!

Thanks in advance,

A very frustrated Flatfoot! :)

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2009-12-16 01:42

do you have any publicly viewable items?
get this to work first:
http://www.chrisibbeson.com/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Flatfoot

Joined: 2009-12-07
Posts: 17
Posted: Wed, 2009-12-16 05:41

Hi Dave,

I wish I could get that to work! :)

Here is what I have:

An empty root album called "Your Trail Gallery" (http://www.chrisibbeson.com/gallery2/main.php). This just shows a message on the main page.

When users register, an album is created for them as a sub-item of this album.

I have "Everybody" as able to view User Albums under site admin.

I tried doing an "Edit Album" on this main empty root album. I have the imageblock as being displayed in the sidebar. But all I see is search, mount with Webdav, and RSS feed.

Why is there no random image? I must be missing something, but I can't see what.

True, there are no images in this album, but there are sub-albums with pictures.

Thanks for your help

-Flatfoot

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2009-12-16 05:51
Quote:
but there are sub-albums with pictures.

Do the guest users have permissions to view them?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Flatfoot

Joined: 2009-12-07
Posts: 17
Posted: Wed, 2009-12-16 13:37

Dave-

Here are the "User Album" settings from site admin:
User Album Settings

An album will be created for each user. The user will have full permissions on the album.
Create albums : When user is created
Albums viewable by : Everybody
Full size images viewable: Yes
Location for new user albums : - Your Trail Gallery
Login page: Jump to user album after login

If I go to one user's album. and select "Edit Permissions", here is what I get:

Group Permissions
Group name Permission Action
Registered Users [core] View all versions <=== is this the problem??
Everybody [rating] All access
Everybody [digibug] Print
Everybody [ecard] Send eCards
Everybody [fotokasten] Print
...

Could the problme be the line I indicate?

Thanks,
-Flatfoot

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-12-16 13:45

yup you need:
Everybody [core] View all versions.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
Flatfoot

Joined: 2009-12-07
Posts: 17
Posted: Wed, 2009-12-16 13:46

Dave,

I just tried something that surprised me. I logged in as a "regular user" - not admin. Then I went to that user's album page. When I switched the "View mode" from that user to "Guest" - wow! I saw nothing!

Is it that setting I indicate above??

Thanks,
-Flatfoot

 
Flatfoot

Joined: 2009-12-07
Posts: 17
Posted: Wed, 2009-12-16 13:49

suprsidr

Thanks! I'll give it a try. Is this a global setting that can be applied to all user albums, or does each user have to manually set this?

-Flatfoot

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-12-16 13:55

Your albums are probably inheriting from the parent album - check your perms there.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
Flatfoot

Joined: 2009-12-07
Posts: 17
Posted: Wed, 2009-12-16 15:38

Voila! That did it. Actually, I had changed the parent permissions after the sub-album was created. Even though I had the "apply to sub albums" checked in the parent (empty root album), I'm guessing it meant that the change would take effect "from now on". So I went to the sub-albums and gave Everybody "[core] View All Versions" permission and that did the trick.

So - I hope that in the future, new sub-albums will be created with the parent's (empty root album) permissions for Everybody to view all.

Thank you all for your help!

-Flatfoot