1.

Solve : Allow user to specify background in URL?

Answer»

Hi,

I'm working on a website that lets you choose a background image from placing it in the URL.

For example, if the URL is http://www.mysite.com?image=http://www.imagehost.com/cat.jpg, the page background will be the image at http://www.imagehost.com/cat.jpg

I think it is possible with PHP but I can't work out how to use it.

My server supports PHP, HTML and Javascript and I'd rather not use Flash Code: [SELECT]<?php

$bg = $_GET['image'];

echo "
<STYLE type=\"text/css\">
  body {
    background-image: url(\"" . $bg . "\");
  }
</style>";

?>

etc. etc....something like this:
Code: [Select]<html><head>
<title>Image VIEWER</title>
</head>
<body>
<img src="<?php
echo $_GET['image'] ?>">
</body>
</html>
curses
oh wait, background image. never mind, heh.Thanks - That worked  Which one? (please say mine...please say mine...) Quote from: kpac on MARCH 09, 2010, 11:20:30 AM

Which one? (please say mine...please say mine...)

Well I'd hope so, SINCE your's changes the background like he wanted and mine just sorta forces in a img tag.


Discussion

No Comment Found