1
Ghoti
PHP and Custom Blocks
  • 2004/6/29 21:53

  • Ghoti

  • Just popping in

  • Posts: 5

  • Since: 2004/6/29


I'm having something of an issue in trying to make a custom block on a site I'm working on, and was hoping that I could get a couple pointers.

I'm trying to include a PHP script that creates an image. The script works perfectly standalone, as can be seen here.

However, when I copy that code into a custom block assigned as PHP code, all I get is an empty block- I see the name of the block, but immediately below that, the name of the next block.

I found in another thread that removing the '<?' and '?>' tags may help, but when I do that, I get an error message, which is an image with the following text:

The image "http://hfr.hfbgaming.com/~hfr//modules/system/admin.php" could not be displayed, because it contains errors.

If it will help y'all help me, the source for the PHP script can be seen here.

Thanks in advance for any help!

2
tl
Re: PHP and Custom Blocks
  • 2004/6/29 22:43

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


Your problem probably is the header calling. I don't think you could call header after XOOPS has already done so.

Header("Content-type: image/png");

Turn the debug and see what errors you are getting.

3
Ghoti
Re: PHP and Custom Blocks
  • 2004/6/30 2:50

  • Ghoti

  • Just popping in

  • Posts: 5

  • Since: 2004/6/29


Quote:

tl wrote:
Your problem probably is the header calling. I don't think you could call header after XOOPS has already done so.

Header("Content-type: image/png");

Turn the debug and see what errors you are getting.


When I take out the 'Header' line, the block appears, but with the .png file displayed as ASCII text (read: gibberish).

When I turn on debug mode, I get the same results if I do include the Header line as before, as well as after.

Any other ideas? I'd really like to get this working!

4
tl
Re: PHP and Custom Blocks
  • 2004/6/30 3:00

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


try this
print "Content-type: image/png\n\n";

If not working, then you'll need PHP gurus out of there to help you out.

5
Ghoti
Re: PHP and Custom Blocks
  • 2004/6/30 5:01

  • Ghoti

  • Just popping in

  • Posts: 5

  • Since: 2004/6/29


I got it working. I could have sworn I tried this before I posted here, but this is what got it working:

Rather than making it a PHP block, I just dropped that idea and made it an HTML block, with the following code:
<img src="http://hfr.hfbgaming.com/~hfr/stats/3/index.php">


Works like a charm.

Thanks for your help!

(indicdentally, the advice you have just prepended Content-type: image/png\n\n to the PNG file displayed as ASCII.

Thanks very much for your help though!

6
alyussiu
Re: PHP and Custom Blocks
  • 2004/8/16 18:17

  • alyussiu

  • Not too shy to talk

  • Posts: 119

  • Since: 2004/4/9 9


This thread is quite old, but I'd like to thank you for this idea Ghoti ^-^.

I was searching for one hour how to make this php code works without any success... Then, I tried your idea with my php file and it's working now!

Instead of an image, I call the page -> include "mypage.php";

^O^.

Thanks ;)

7
Ghoti
Re: PHP and Custom Blocks
  • 2004/8/17 15:54

  • Ghoti

  • Just popping in

  • Posts: 5

  • Since: 2004/6/29


Quote:
alyussiu wrote:
This thread is quite old, but I'd like to thank you for this idea Ghoti ^-^.

I was searching for one hour how to make this php code works without any success... Then, I tried your idea with my php file and it's working now!

Instead of an image, I call the page -> include "mypage.php";

^O^.

Thanks ;)


I'm delighted to've been able to assist!

Login

Who's Online

183 user(s) are online (109 user(s) are browsing Support Forums)


Members: 0


Guests: 183


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits