External Image Block only work with local IP address and not Domain Name

derickson

Joined: 2006-04-13
Posts: 32
Posted: Thu, 2007-05-17 00:55

We have a web server with gallery 2.2.1 installed. Our school website and the photo gallery are on the same server. For many months I used the External Image Block of:

<?php @readfile('http://www.evangelacademy.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>

But at some point, not sure when this stopped working. The page loads extremely slow, about 40 to 60 seconds. Then displays the page content without the image block. I tried using the local IP address in place of the domain name, like so:

<?php @readfile('http://192.168.102.2/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>

The page loads slow, about 10 to 15 seconds but at least the image block works. I tried using a relative path and that did not work.

I have search the forum for a similar problem with not luck. I did find this code and it did work:

<?php
 /* You'll have to change the /gallery2/ thing in the following 2 lines probably */
 require_once(dirname(__FILE__) . '/gallery/embed.php');
 $ret = GalleryEmbed::init(array('fullInit' => true, 'embedUri' => '/', 'g2Uri' => '/gallery/main.php'));
 if ($ret) {
     print 'GalleryEmbed::init failed, here is the error message: ' . $ret->getAsHtml();
     exit;
 }
 /*
  * See "Site admin" -> "image block" for all available options. the parameters are the same
  * as for the external imageblock
  */
 list ($ret, $bodyHtml, $headHtml) = GalleryEmbed::getImageBlock(array('blocks' => 'randomImage',
                                                                 'show' => 'title|date'));
 if ($ret) {
     print 'GalleryEmbed::getImageBlock failed, here is the error message: ' . $ret->getAsHtml();
     exit;
 }
 /* $bodyHtml contains the image block. print it somewhere on your website */
 print $bodyHtml;
 /*
  * $headHtml is not required. if you use imageframes for your imageblocks, you need to print 
  * $headHtml in the <head> section of your web page
  */
 ?>

But I am not sure how to manipulate it. Can someone please advise me on the problem? The instructions for setting up the external image block are fairly straight forward, and like I said it have been working for some time.

Thank you in advance,
David Erickson

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2007-05-17 01:40

Perhaps your server admin disabled readfile.
When I navigate to: http://www.evangelacademy.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title your imageblock does indeed show.
You could try my XML miniSlideShow.

-s
FlashYourWeb and Your Gallery

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Thu, 2007-05-17 14:12

How when I check to see if readfile is disabled and enable it?

Or is there another PHP function that I should use?

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Thu, 2007-05-17 18:41

Suprsidr,

I think I will use your XML miniSlideShow it looks great.

Also, how do I get the E2_Player? We have a bunch of flash video that I am trying to put on our site in a nice player.

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Thu, 2007-05-17 19:12

I am trying to set this up. I copied the minislideshow.swf and the 3 .php files to my gallery folder, called galley. This folder is located on in the root of the website. I edited line 5 of the 3 files from gallery2 to gallery. When I placed the embeded code onto one of my pages and loaded the page I just got the spinning wheel saying "Loading XML Feed"

I tried the following code:

<embed src="http://www.evangelacademy.com/gallery/minislideshow.swf"
flashvars="xmlUrl=http://www.evangelacademy.com/gallery/xml_all.php&shuffle=true"
quality="high" wmode="transparent" width="160" height="160" name="slideshow"
align="middle" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />

When I tried this:

<embed src="http://www.evangelacademy.com/gallery/minislideshow.swf"
flashvars="xmlUrl=http://www.evangelacademy.com/gallery/xml_dynamic.php?
g2_view=dynamicalbum.RandomAlbum&g2_albumId=7" quality="high" wmode="transparent" 
width="160" height="160" name="slideshow" align="middle" type="application/x-shockwave-
flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

When I changed the .php line 5 from this:
'embedUri' => '/gallery/main.php', 'g2Uri' => '/gallery/'));
to this:
'embedUri' => '../../../../../gallery/main.php', 'g2Uri' => '../../../../../gallery/'));

I got the spinning wheel and it said loading 1 of 50 pictures. It never loaded.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2007-05-17 21:03

Sorry, been at work.

Quote:
'embedUri' => '../../../../../gallery/main.php', 'g2Uri' => '../../../../../gallery/'));

those need to be URLs, not paths.
try'embedUri' => 'http://www.evangelacademy.com/gallery/main.php', 'g2Uri' => 'http://www.evangelacademy.com/gallery/'));
IF you must use full URLs.

As for the E2_Player, its not quite ready for PrimeTime. But we built a nice flashVideo player into G2 already :)

-s
FlashYourWeb and Your Gallery

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Fri, 2007-05-18 13:26

Where is the flashVideom player for G2?

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Fri, 2007-05-18 14:03

ok, That change worked.
1. I am using xml_dynamic.php random album, the pictures are random but they are in the same order everytime I refresh the page. If there any way to fix that?
2. How do I put the drop shadow on the pictures?

Thanks for this great solution

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Fri, 2007-05-18 17:49

If I use xml_all.php it doesn't seem to load pictures and I get a message that says "Loading 1/D"

When I use xml_dynamic.php it will say "Loading 1/50" and just takes a second.

I am note sure what the issue is but when I use:

  <embed src="http://www.evangelacademy.com/gallery/minislideshow.swf"
flashvars="xmlUrl=http://www.evangelacademy.com/gallery/xml_dynamic.php?g2_view=dynamicalbum.RandomAlbum&g2_albumId=629&shuffle=true" quality="high" wmode="transparent"
width="250" height="250" name="slideshow" align="middle" 
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

The pictures displayed are not all from the albumID I enter, if I use g2_itemID the problem is the same.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2007-05-18 21:53
Quote:
Where is the flashVideom player for G2?

the flashvideo module
admin->plugins->flashvideo
just install it, upload your flv movies, and the flashvideo module/player will render it.

Quote:
If I use xml_all.php it doesn't seem to load pictures and I get a message that says "Loading 1/D"

yoursite has 14,000 images right?
really not a good idea to use xml_all.php - it would take a long time to render that xml feed each time.

Quote:
xmlUrl=http://www.evangelacademy.com/gallery/xml_dynamic.php?g2_view=dynamicalbum.RandomAlbum&g2_albumId=629&shuffle=true

Ok, the xml_dynamic.php is for use with dynamic albums only. so you would add the view(g2_view=dynamicalbum.RandomAlbum) only, not the g2_albumId.
If you want to display the items in a specific album use xml.php?g2_itemId=629 where 629 is the g2_itemId of the album you want to display.
I tried to use the same terminology as gallery2 itself to (hopefully) keep the confusion down.

Quote:
How do I put the drop shadow on the pictures?

I'm just adding that now, it will be out with the next release, along with a few more options, like delay.
Hopefully in the future I will combine all the xml.phps into one, and write a script to aid in embedding.

:)

Did I get them all?

-s
FlashYourWeb and Your Gallery

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Sat, 2007-05-19 14:29

Ok, got it thank you.

Quote:
Ok, the xml_dynamic.php is for use with dynamic albums only. so you would add the view(g2_view=dynamicalbum.RandomAlbum) only, not the g2_albumId.
If you want to display the items in a specific album use xml.php?g2_itemId=629 where 629 is the g2_itemId of the album you want to display.
I tried to use the same terminology as gallery2 itself to (hopefully) keep the confusion down.

When I pasted this link in to the address line of a abrowser it seems to honor the album variable?
http://www.evangelacademy.com/gallery/xml_dynamic.php?g2_view=dynamicalbum.RandomAlbum&g2_albumId=629&shuffle=true

Also, in the I can use the dynamic album link to view random images from a specific album and subalbums, like so:

http://www.evangelacademy.com/gallery/main.php?g2_view=dynamicalbum.RandomAlbum&g2_albumId=629

Thank you so much for your help.