PDA

View Full Version : [PHP] Making a script show as an image



MrCraig
15-06-2007, 07:03 PM
Right, well i got this thing off habboring for habbofunctions.

Does anyone know how to make it show up as an image?

for example..

www.habbo-center.com/habbo/image.php?name=lost_witness (http://www.habbo-center.com/habbo/image.php?name=lost_witness)
works.

yet


<img src="www.habbo-center.com/habbo/image.php?name=lost_witness (http://www.habbo-center.com/habbo/image.php?name=lost_witness)" />

doesnt.

Thanks for any help.

Mentor
15-06-2007, 07:04 PM
Im guessing the main problem is due to it haveing a .php exstention - which stops forum parsing it. Although for a normal html embed i would have expected it to work... maybe the rediret it uses is whats causeing the problem?? or another possiblty is if hotlink protection is enabled.

MrCraig
15-06-2007, 07:19 PM
it doesnt work on habbo-center servers either. So its nothing to do with hotlink protection,, which is disabled anyways..

Invent
15-06-2007, 07:27 PM
Make a file called Habbo.php, inside it put:



<?php

if($_GET['name'] && !empty($_GET['name'])) {
$contents = file_get_contents( "http://www.habbo-center.com/habbo/image.php?name=".

$_GET[name] ."" );

$contents = explode("<img src=\"http://www.habbo.co.uk/habbo-imaging/avatar/", $contents);

$contents = str_replace("\">", "", $contents[1]);

echo("http://www.habbo.co.uk/habbo-imaging/avatar/". $contents ."");
}
?>
Then do:



<img src="www.habbo-center.com/habbo.php?name=lost_witness (http://www.habbo-center.com/habbo/image.php?name=lost_witness)" />


That MIGHT work.

Or just do htaccess :P

Sunny.
15-06-2007, 07:43 PM
could jus right click n go to properties

http://www.habbo.co.uk/habbo-imaging/avatar/1760118009877352851430005014400e990652107f4b1dc37d f31a2446d14aa.gif

but if you need them all showing up in the url then Id go with Simons post

MrCraig
15-06-2007, 08:09 PM
k, ive done it a diff way (just putting an iframe to the display page and declaring the variable in that.)

http://www.habbo-center.com/v6/staff.php if u wanna see it..

Any suggestions to improve it?

Later, im going to do categorys to narrow down the search..

timROGERS
16-06-2007, 07:27 AM
It's because on the actual function, it is making a page with the image displayed on it, instead of simply outputting the image as most do.

MrCraig
16-06-2007, 04:10 PM
Nope, that not wokring invent..

NinetndoNews - Do you know the code to make it so it just displays the image?

as the iframe version ive resorted to has a very slow load time.

MegaEdition
16-06-2007, 04:21 PM
make a file called .htaccess

with this in


Options +Indexes
RewriteEngine on
RewriteRule ^staff/(.*).png$ image.php?name=$1
and then put that in the directory that image.php is in then for the image it will be
http://www.habbo-center.com/habbo/staff/staffname.png

it will load
http://www.habbo-center.com/habbo/image.php?name=staffname

Want to hide these adverts? Register an account for free!