phpBB signature not excepting dynamic images?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

phpBB signature not excepting dynamic images?

Post by WaldoMonster »

I'm working on a dynamic image that will display the last played albums.
This is working fine from a web browser.
But when trying to add it to a phpBB signature it only displays the text like:

Code: Select all

[img]http://beta.netjukebox.nl/image.php?action=LastPlayed[/img]
Adding a static image in the same way will display the image correctly.
I also have tried adding &ext=.gif to the url but this didn't help.
Any suggestion?

http://beta.netjukebox.nl/image.php?action=LastPlayed

Header send:

Code: Select all

HTTP/1.1 200 OK
Date: Tue, 22 May 2007 09:46:05 GMT
Server: Apache
Content-Length: 6076
Keep-Alive: timeout=15, max=97
Connection: Keep-Alive
Content-Type: image/gif
Last edited by WaldoMonster on Tue May 22, 2007 5:17 am, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

phpbb uses
bbcode.php wrote:$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
to test an image-url. It doesn't take the query string into account, only the path component of the url (i.e. it stops at the first question mark)
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

Now I see that it must also have a jpg, jpeg, gif or png extension.
So I can forget the dynamic php script.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

WaldoMonster wrote:Now I see that it must also have a jpg, jpeg, gif or png extension.
So I can forget the dynamic php script.
Not at all. You just have to name the script .jpg and configure your web server to parse .jpg as PHP. If you're using Apache you'd need to use something like:

Code: Select all

AddType application/x-httpd-php .php .jpg
toasty2
Forum Contributor
Posts: 361
Joined: Wed Aug 03, 2005 10:28 am
Location: Arkansas, USA

Post by toasty2 »

onion2k wrote:Not at all. You just have to name the script .jpg and configure your web server to parse .jpg as PHP. If you're using Apache you'd need to use something like:

Code: Select all

AddType application/x-httpd-php .php .jpg
Wouldn't that give errors when you put a normal image up? And it is possible to embed PHP code into an image which can be a very bad security issue.

So instead use url rewriting. (like change pic.png to pic.php)
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

Is it possible to use a dot in addtype?

Code: Select all

AddType application/x-httpd-php .php .php.jpg
Than you can use the script like this: image.php.jpg
And don't interfear with .jpg files.
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

I think that your trick will work.
First I will get ride off the ?action=LastPlayed section and use: http://beta.netjukebox.nl/image.php/dummy.jpg
I will come back later :wink:
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

WaldoMonster wrote:
I think that your trick will work.
First I will get ride off the ?action=LastPlayed section and use: http://beta.netjukebox.nl/image.php/dummy.jpg
I will come back later :wink:
Thanks volka,

Your solution did the trick :D
Post Reply