ImageBlock not working - http://www.studio4tattoos.co.uk/gallery2/

GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 12:49


<!-- Required Information -->
Gallery URL = http://www.studio4tattoos.co.uk/gallery2/main.php
Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.11 cgi
Webserver = Apache/2
Database = mysqli 5.0.89-community, lock.system=flock
Toolkits = LinkItemToolkit, Exif, ArchiveUpload, Gd
Acceleration = none, none
Operating system = Linux web125.extendcp.co.uk 2.6.9-89.0.19.ELsmp #1 SMP Wed Dec 30 12:53:30 EST 2009 i686
Default theme = carbon
gettext = enabled
Locale = en_GB
Browser = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7
Rows in GalleryAccessMap table = 12
Rows in GalleryAccessSubscriberMap table = 3
Rows in GalleryUser table = 2
Rows in GalleryItem table = 3
Rows in GalleryAlbumItem table = 2
Rows in GalleryCacheMap table = 0

<!-- Issue Details -->
Hello all.

I have been trying without success to solve this problem, but really cannot. The imageblock will not display on my page. I have tried both imageblock and mediaBlock to perform this, but without success. I have a index.php file and using the @readfile I cannot display the images.

By utilising an iframe on my webpage, I can get the results I require, but the iframe is an inferior solution, and to be honest - an ugly one with minimal support for various browsers.

I have also utilised the CURL solution found on the net, and this seems to work when I use someone else's website (they gave a link to use) but using my link it will not work.

Can anyone please help me. Is there a way to enable the @readfile() command (I have full control over my php.ini file).

Any help would be appreciated.

Regards,
Gaz

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 14:17

You need to enable the fopen_wrappers in php.ini

Post a link to your phpinfo
instructions for creating a phpinfo here.

I also have a jquery version of mediaBlock and the ever popular minislideshow.

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 15:25

Apologies for the missing phpinfo link. http://www.studio4tattoos.co.uk/phpinfo.php

Will look into the php.ini file now.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 15:36
GazNicki wrote:
I have full control over my php.ini file

suprsidr wrote:
You need to enable the fopen_wrappers in php.ini

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 15:47

Yeah, I have control of the php.ini but limited knowledge on how to adjust it lol.

fopen_wrappers is not listed in the php.ini file I have, but I have added the following:

; fopen_wrappers
;
fopen_wrappers = On

This hasn't resolved the issue, and I am struggling to find how to enable it in the php.ini file using Google. Any advice??

Edit:
phpinfo.php indicates the following:

allow_url_fopen:
Local Value = On
Master Value = On

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 16:06

http://us3.php.net/manual/en/function.readfile.php

Quote:
A URL can be used as a filename with this function if the fopen wrappers have been enabled.

what code are you using in your imageblock/mediaBlock call?
where are you trying to display these blocks?
as answered in my forums, mediaBlock is outputting content:
http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&g2_view=dynamicalbum.RandomAlbum&showTitle=1&useThumb=1&column=3

looks like you've added <head> and <body> tags to mediaBlock??? Not advised when you include its output in other pages.

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 16:14

Please advise which forums your preferance for us to use is.
I have setup an index.php and an index.htm.

The htm file is ustilising iframes with formatting through a CSS file to allow some level of cross-browser compatability. Unfortunately, this is not the ideal answer to the problem.

The php file is using the @readfile commands. When I have loaded up the sourcecode through the web-browser however for the php file, the @readme lines are not shown in the code.

The code for the HTML file is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
	<title>Studio4Tattoos - Home</title>
	<link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>
	<div id="container">
		<div id="middle">
			<div class="header">
				<p align="center"><img src="images/header.png" width="100%" alt="header" /></p>
			</div>
			<div class="menu">
			<div id="nav-menu">
				<ul>
					<li><a href="#">Home</a></li>
					<li><a href="#">Gallery</a></li>
					<li><a href="#">Forums</a></li>
					<li><a href="#">About Us</a></li>
					<li><a href="#">Contact Us</a></li>
					<li><a href="#">Facebook</a></li>
				</ul>
			</div>
			</div>

			<div class="mleft">
				<h1>Welcome</h1>
				<p class="subhead">09 February 2010 17:27pm</p>
				<p>Welcome to Wigan's premier Tattoo Studio, Studio4Tattoos.<br />
				We are a family run business, with over 10yrs of experience in the Tattoo industry. We 
				specialise in all styles of work including Cover Ups, U.V,
				and Custom Designs. We have millions of flash designs both in Books and on the Computer. 
				Our team of Reception Staff and Tattoo Artists are friendly and 
				welcoming and enjoy working on-hand with all our clients to offer 
				advice and guidance, and to help design those one-off custom 
				Tattoos!</p>
			
				<p>Feel free to visit us at our studio: 25 Wigan Lane, Wigan, WN1 
				1XR</p>
				
				<div class="hr"><hr /></div>
				
				<h2>Welcome</h2>
				<p class="subhead">09 February 2010 17:27pm</p>
				<p>Our website is currently under development, but should be up and running by the end of the week.<br />
				Everyone at Studio4Tattoos.co.uk wish you all a very happy Valentines Day 2010!</p>
			</div>
			
			<div class="mright">
				<h5>Whats New?</h5>
				<p class="news">Our Latest Tattoo:</p>
				<!-- This section is for mediaBlock (Latest Tattoo - Single Photo) -->
				<iframe
					src="http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?g2_itemId=16&useThumb=1&useMicro=150px&g2_view=imageblock.External&dynamicalbum.UpdatesAlbum&limit=1&noLink=1"
					width="153"
					height="115"
					frameborder="0"
					marginheight="0"
					marginwidth="0"
					name="MediaBlock"
					scrolling="no"
					framespacing=2
					allowTransparency="true"
					bgcolor="#333333"
					style="z-index:1" />
				</iframe>
				
				<h5>Examples!</h5>
				<p class="news">Random Tattoos by us:</p>
				<!-- This section is for mediaBlock (3 Random images stacked ontop of each other) -->
				<iframe
					src="http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?useThumb=1&useMicro=150px&dynamicalbum.RandomAlbum&limit=3&noLink=1"
					width="153"
					height="349"
					frameborder="0"
					marginheight="0"
					marginwidth="0"
					padding="0"
					name="MediaBlock"
					scrolling="no"
					framespacing=2
					allowTransparency="true"
					background-color="000"
					style="z-index:1" />
				</iframe>
			</div>
			
<!-- 	This is the code for the Footer of the Website. Changes to this would have to be replicated on every page, although the content shouldn't require changing.
		Code here will automatically update the later year in the footer as time progresses. -->
			<div class="footer">
			Copyright &copy; 2010
			<script language="JavaScript">
				var d=new Date(); 
				yr=d.getFullYear();
				if (yr!=2010)
				document.write("- "+yr);
			</script> Studio4Tattoos.co.uk<br />
			Website Designed, Developed, Hosted and Serviced by <a href="http://www.gptsolutions.co.uk/" target=_blank>GPTSolutions.co.uk</a>
			</div>
		</div>

<!-- Here we have the code for the LeftRail. This is used as a border on the left, but since it is a DIV can be used to house content -->		
		<div id="leftRail">
			<p>&nbsp;</p>
		
		</div>

<!-- Here we have the code for the RightRail. This is used as a border on the right, but since it is a DIV can be used to house content -->		
		<div id="rightRail">
			<p>&nbsp;</p>
		</div>
</div>	
</body>
</html>

The code for the PHP file is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
	<title>Studio4Tattoos - Home</title>
	<link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>
	<div id="container">
		<div id="middle">
			<div class="header">
				<p align="center"><img src="images/header.png" width="100%" alt="header" /></p>
			</div>
			<div class="menu">
			<div id="nav-menu">
				<ul>
					<li><a href="#">Home</a></li>
					<li><a href="#">Gallery</a></li>
					<li><a href="#">Forums</a></li>
					<li><a href="#">About Us</a></li>
					<li><a href="#">Contact Us</a></li>
					<li><a href="#">Facebook</a></li>
				</ul>
			</div>
			</div>

			<div class="mleft">
				<h1>Welcome</h1>
				<p class="subhead">09 February 2010 17:27pm</p>
				<p>Welcome to Wigan's premier Tattoo Studio, Studio4Tattoos.<br />
				We are a family run business, with over 10yrs of experience in the Tattoo industry. We 
				specialise in all styles of work including Cover Ups, U.V,
				and Custom Designs. We have millions of flash designs both in Books and on the Computer. 
				Our team of Reception Staff and Tattoo Artists are friendly and 
				welcoming and enjoy working on-hand with all our clients to offer 
				advice and guidance, and to help design those one-off custom 
				Tattoos!</p>
			
				<p>Feel free to visit us at our studio: 25 Wigan Lane, Wigan, WN1 
				1XR</p>
				
				<div class="hr"><hr /></div>
				
				<h2>Welcome</h2>
				<p class="subhead">09 February 2010 17:27pm</p>
				<p>Our website is currently under development, but should be up and running by the end of the week.<br />
				Everyone at Studio4Tattoos.co.uk wish you all a very happy Valentines Day 2010!</p>
			</div>
			
			<div class="mright">
				<h5>Whats New?</h5>
				<p class="news">Our Latest Tattoo:</p>
<?php
@readfile('http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?g2_itemId=16&useThumb=1&useMicro=150px&g2_view=imageblock.External&dynamicalbum.UpdatesAlbum&limit=1&noLink=1');
?>
<?php @readfile('http://www.studio4tattoos.co.uk/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
<?php
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://www.studio4tattos.co.uk/gallery2/mediaBlock.php?mode=dynamic&g2_view=tags.RandomAlbum&g2_tagName=tattoo&useThumb=1&column=1&useMicro=150');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
?>
			</div>
			
<!-- 	This is the code for the Footer of the Website. Changes to this would have to be replicated on every page, although the content shouldn't require changing.
		Code here will automatically update the later year in the footer as time progresses. -->
			<div class="footer">
			Copyright &copy; 2010
			<script language="JavaScript">
				var d=new Date(); 
				yr=d.getFullYear();
				if (yr!=2010)
				document.write("- "+yr);
			</script> Studio4Tattoos.co.uk<br />
			Website Designed, Developed, Hosted and Serviced by <a href="http://www.gptsolutions.co.uk/" target=_blank>GPTSolutions.co.uk</a>
			</div>
		</div>

<!-- Here we have the code for the LeftRail. This is used as a border on the left, but since it is a DIV can be used to house content -->		
		<div id="leftRail">
			<p>&nbsp;</p>
		
		</div>

<!-- Here we have the code for the RightRail. This is used as a border on the right, but since it is a DIV can be used to house content -->		
		<div id="rightRail">
			<p>&nbsp;</p>
		</div>
</div>	
</body>
</html>
 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 16:52

So you're trying to embed gallery in yoursite? try my easy form.

otherwise I see several issues

Quote:
http://www.studio4tattos.co.uk/gallery2/mediaBlock.php?mode=dynamic&g2_view=tags.RandomAlbum&g2_tagName=tattoo&useThumb=1&column=1&useMicro=150

only one o in tatoos? and should be tags.VirtualAlbum

Quote:
http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?g2_itemId=16&useThumb=1&useMicro=150px&g2_view=imageblock.External&dynamicalbum.UpdatesAlbum&limit=1&noLink=1

no need for px - g2_view=imageblock.External should be mode=dynamic

other then the misspelled tatoo these are outputting content.
So curl should work for you if readfile is not.
you can also use:

<?php
echo file_get_contents('http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&g2_view=dynamicalbum.RandomAlbum&useThumb=1&column=1&useMicro=150');
?>

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 17:18

I am now using the following in the PHP file:

<? php
echo files_get_contents('http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&g2_view=dynamicalbum.RandomAlbum&useThumb=1&column=1&useMicro=150');
?>


<?php
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&g2_view=tags.VirtualAlbum&g2_tagName=tattoo&useThumb=1&column=1&useMicro=150');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
?>

Unfortunately neither of these two produce any form of output. Where am I going wrong??

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 17:25

if the file you are placing this code in does not have the .php extension then the php will not get executed.

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 17:29

It does have a php extention, it is the index.php file.

I have used your easy form, and it is a fantastic piece of kit, but not the result I am after. I just require to link the images to the index page. Getting the PHP file to work properly is turning out to be quite important. While the HTM file is using the iframes with great success, the PHP file will offer greater versatility to my website.

Is there anything else that you can see that I am doing wrong with either of these pieces of code? Is there anything else I should enable in php.ini??

I'm sorry this is turning into a headache.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 17:41
 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 17:52

try this:

<?php
function curlGet($url) {
    $ch = curl_init();
    $timeout = 5; // set to zero for no timeout
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $file_contents = curl_exec($ch);
    curl_close($ch);
    echo $file_contents;
}
?>
/** Use this to display your content */
<?php @curlGet('http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&g2_view=dynamicalbum.RandomAlbum&useThumb=1&column=1&useMicro=150'); ?>

and remove the:
<html>
<head><link rel="stylesheet" href="style.css" type="text/css" /></head>
<body>
from mediaBlock.php

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

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 17:55

And if you enable the image frame module you'll get the dropshadow

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 17:58

Removed all additions to mediBlock.php and adjusted the index.php file to utilise the code you have above.

This is the end result: http://www.studio4tattoos.co.uk/index.php

I have tested the functionality of php by using a simple hello world code:
<?php
echo "hello world!";
?>

This displays hello world! in my site, so the php must be functioning properly. I just have no idea why none of this is working right. I feel like crying lol

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 18:20
 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Tue, 2010-02-16 19:01
 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-02-16 20:35

Sorry.
The only issues I see in your php: output_buffering should be zero and upload_max_filesize you'll want larger then 2M

and why am I seeing /** Use this to display your content */
That comment should be ignored. can you attach your index.php to this forum?

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 09:55

Thanks. I have updated the php.ini file and this should now be reflected in the phpinfo.php file.

Below is a copy of the index.php file that is currently on my server. Both versions are identical, I haven't made any changes either server-side or locally.

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 11:48

I decided to make a fresh php file and start again to test the integrety of the website and try and narrow this problem down. There really is only 3 possible problems:

1) Corrupt mediaBlock.php file - Not the case as it is working when linked directly to. Never-the-less I have re-downloaded this file and replaced it on the server.
2) Corrupt coding in my index.php file - This would be my error so a fresh index2.php file was created to test the server.
3) Incorrect server settings - I have created my index2.php file to display errors.

The file can be found here:
http://www.studio4tattoos.co.uk/index2.php

What I have found is that @readfile displays nothing. No error and no output. I have linked it to a variable using the following code to see if it helps:
<?php
$a = @readfile('http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&amp;amp;g2_view=dynamicalbum.RandomAlbum&amp;amp;showTitle=1');
echo ($a);
?>

This didn't work either.

Since readfile didn't work, I decided to try file_get_contents like so:
<?php
$a = file_get_contents('http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&amp;g2_view=dynamicalbum.RandomAlbum&amp;showTitle=1');
echo ($a);
$b = file_get_contents('http://www.studio4tattoos.co.uk/index.htm');
echo ($b);
?>

Guess what ... we get errors!!
Warning: file_get_contents(http://www.studio4tattoos.co.uk/gallery2/mediaBlock.php?mode=dynamic&amp;g2_view=dynamicalbum.RandomAlbum&amp;showTitle=1) [function.file-get-contents]: failed to open stream: Connection refused in /home/sites/studio4tattoos.co.uk/public_html/index2.php on line 12

Warning: file_get_contents(http://www.studio4tattoos.co.uk/index.htm) [function.file-get-contents]: failed to open stream: Connection refused in /home/sites/studio4tattoos.co.uk/public_html/index2.php on line 14

If we slip in another cheeky bit of code, we can prove that the file_get_contents actually works for an EXTERNAL website, but not for an internal one. This code proves it:

$c = file_get_contents('http://www.google.co.uk');
echo ($c);

I have attatched a copy of the index2.php file that I have been using to test this. It is now live too via http://www.studio4tattoos.co.uk/index2.php

I hope this can bring us one step closer :(

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 13:12

so here is your index.php copied to my curlTest http://www.flashyourweb.com/gallery2/curlTest.php
the top 2 images use my curl function and the bottom 2 use readfile
So your server refuses connections from itself, but accepts foreign connections?
gonna have to google that one or maybe I'll Bing it ;)

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 13:23

Yeah that seems to be the issue that I have at the moment.

I do have the ability to switch to PHP4 4.4.9, but have been advised that the issue is more a settings issue. I have been trying to google but not a thing yet.

Sorry this is turning into a headache. I really appreciate your help.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 13:37
 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 13:45

Unfortunately me neither lol. Thats quite confusing lol

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 13:54

Hmm. Johnny-come-lately to this one too. First thing to check (if I understand what I read right) is whether the server can open any connections to itself: can you use wget from a shell, or lynx, to your own website? Try via http://localhost/... too.

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 13:57

beyond my knowledge at the moment that. But I will certainly try to fathom it out.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 13:59

OK - but in the spirit of divide-and-conquer, you need to narrow down whether it's a server issue (wget doesn't work either) or a php issue (wget and lynx are fine loading local pages, but nothing in php works).

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 14:03

Any advice on where I should start with the wget? Will I need SSH Access??

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 14:08

To me it looks to be an apache issue. php cannot refuse connections.

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

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 14:09

Yes, you'll need SSH access to use a shell session (SSH is short for Secure SHell... I wouldn't recommend telnet) unless your server is physically local and you have a screen and keyboard attached, which I guess it isn't.

wget is a standard system tool for fetching files via http from a command prompt. Lynx is a text-only browser. It's quite likely that wget is available to you already if you open a shell. try "wget --help" for syntax, but basically you can type "wget <url>" to fetch something.

Quote:
To me it looks to be an apache issue.

It could be apache refusing a local connection; it could be an IP filter refusing outbound connections to local host; it could be something else in the TCP/IP stack fouling up. So there are lots of things to try: telnet to daytime, if it's available, try ssh to localhost from inside the shell, to open another shell inside the first, try to narrow down which combination of system parts shows any problems. Very hard to guess without some tests. Or it could be a php bug, or ... who knows?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 14:15

I also invited nivekiam - that's at least 4 brain cells knocking together ;)
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 14:18

I think my head is going to explode lol

I have submitted a ticket to the Hosting Company to grant SSH access on the account. Is there anything else I can be doing in the mean time?? Changing to 4.4.9 just crashed the Gallery2, so I guess thats not an option at present.

Edit:
Thanks suprsidr. I make my contributions equal to about 0.25% of a cell though haha

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 14:19

Just a thought: you may find it's a "security policy" of the hosting company to block local->local web requests. I can't honestly think why they should find it necessary, but I've heard of stupider things.

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 14:31

What a joke. The Support Team has gotten back to me with a request for ID and a completed document to be faxed to the company before the SSH Access will be granted. :(

Just asked if Local->Local web requests are permitted. Reply from the Service Desk:
Hi Gareth Parkinson
Thanks for contacting us. Loop-back connections are not permitted on our servers and are blocked at the firewall. This is in place to protect the server from its self and is not possible to get around. They should be able to reprogram the script to run the code without calling a loopback.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 14:27
Quote:
The Support Team has gotten back to me with a request for ID and a completed document to be faxed to the company before the SSH Access will be granted.

Not unusual. I have been asked to fax my passport before getting SSH access in the past. And that was on a server with a tight-as-a-badger's-whatsit chroot jail for users.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 14:31

You heard it here first.

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 14:33

Looks like you was bang on the money with the Security there alec. Any idea what the lottery numbers are tonight? lol

So, can I utilise my other server to link to an external mediaBlock.php file that links to the Gallery2 on my studio4tattoos.co.uk server?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 15:07

Sure. Write a script on your other server that takes the params you need to supply and bounces them back in a query to the original server, then reflects the output back. A bit hack-y, but no reason why it shouldn't work.

Maybe you can look at using G2 embedded to display the images you want? Then there's no need for an "internal" web query, you can get G2 to return the html (that you would have got from the query) in a variable, instead. Supersidr is much more knowlegeable than I on that kind of stuff. I'm sure he can advise you.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 15:13

Actually my jquery version may work better. Unless self-ajax calls are blocked as well.
Seems I also made a mediaBlock-includes.php for someone in a similar sit.
it was used lik:

<?php
require_once 'mediaBlockIncludes.php';
$display = '';
$display .= mediaBlock(7, 'mode:dynamic g2_view:tags g2_tagName:cars shuffle:1 useThumb:1 column:4 useMicro:40 rss:1');
$display .= mediaBlock(28371);
$display .= mediaBlock(3735);
echo $display;
?>

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 15:13

Thanks. Unfortunately I don't know where to start with that one. In principle tha basics should work. Send the results from server A -> B, then let server A get the results back from server B.

But how to code lol.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-02-17 15:18
Quote:
Unless self-ajax calls are blocked as well.

One suspects they are, as ajax is carried via http on port 80 also.

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 15:28

Where can I download the mediaBlockIncludes.php file?? This seems like a pretty good option.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 15:45

http://www.flashyourweb.com/filemgmt/index.php
its a few versions behind the current mediaBlock.... I had removed support for this script. But it should function fine for your needs.

BTW you need to enable dynamic albums to use any of the mode:dynamic features

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 17:22

Thanks,

Do I install this into my root or into my gallery2 folder??

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 17:30

does not matter as long as you use the /full/system/path/to/gallery2/embed.php for line 27 and its advisable to use full urls for the g2Uri and embedUri on line 28 (makes it portable)

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 19:07

Using the code:

Quote:
<?php
require_once 'mediaBlockIncludes.php';
echo mediaBlock(16, 'mode:dynamic g2_view:tags g2_tagName:tattoo shuffle:1 useThumb:1 column:1 useMicro:40 rss:1');
?>

Gave this error:

Quote:
Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /home/sites/studio4tattoos.co.uk/public_html/mediaBlockIncludes.php on line 27

Warning: require_once(http://www.studio4tattoos.co.uk/gallery2/embed.php) [function.require-once]: failed to open stream: no suitable wrapper could be found in /home/sites/studio4tattoos.co.uk/public_html/mediaBlockIncludes.php on line 27

Fatal error: require_once() [function.require]: Failed opening required 'http://www.studio4tattoos.co.uk/gallery2/embed.php' (include_path='.:/usr/share/pear5') in /home/sites/studio4tattoos.co.uk/public_html/mediaBlockIncludes.php on line 27

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 19:11
Quote:
/full/system/path/to/gallery2/embed.php

not a url a path ie. /home/sites/studio4tattoos.co.uk/public_html/gallery2/embed.php
the require to mediaBlockIncludes would also be a path
require_once ('/home/sites/studio4tattoos.co.uk/public_html/mediaBlockIncludes.php');

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 19:36

Ok, Changed to /home/sites/studio4tattoos.co.uk/public_html/ as the root folder.

This now rails and displays nothing again. Infact, any further php is no ignored too. No errors, just not display.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2010-02-17 19:46

mediaBlockIncludes.php:

    function init ($full=true){
	    require_once( '/home/sites/studio4tattoos.co.uk/public_html/gallery2/embed.php');
	    $ret = GalleryEmbed::init(array('fullInit' => $full, 'embedUri' => 'http://www.studio4tattoos.co.uk/gallery2/main.php', 'g2Uri' => 'http://www.studio4tattoos.co.uk/gallery2/'));
	    if ($ret) {
	        print 'GalleryEmbed::init failed, here is the error message: ' . $ret->getAsHtml();
	        exit;
	    }
	    GalleryEmbed::done(); 
    }

page you are trying to display content in:

<?php
require_once ('/home/sites/studio4tattoos.co.uk/public_html/mediaBlockIncludes.php');
echo mediaBlock(15, 'useThumb:1 column:1 useMicro:150');
?>

you don't seem to have any tags defined or the tags module is not installed so you cannot use the tags view
to use mode:dynamic g2_view:random you need to enable the dynamics albums module

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

 
GazNicki

Joined: 2009-09-15
Posts: 36
Posted: Wed, 2010-02-17 19:57

Amazing. Thank you!

This works, so now I can tweak it to give the exact results I require. You my friend are nothing short of a genuis.

Big thanks to Alec too!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2010-02-17 20:06

Great work guys! Glad I could help :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here