Page 1 of 1

phpBB signature not excepting dynamic images?

Posted: Tue May 22, 2007 4:57 am
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

Posted: Tue May 22, 2007 5:15 am
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)

Posted: Tue May 22, 2007 6:24 am
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.

Posted: Tue May 22, 2007 6:33 am
by volka

Posted: Tue May 22, 2007 6:59 am
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

Posted: Tue May 22, 2007 7:15 am
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)

Posted: Tue May 22, 2007 7:33 am
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.

Posted: Tue May 22, 2007 7:46 am
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:

Posted: Tue May 22, 2007 8:07 am
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