GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   how to do a random header with css (https://gfy.com/showthread.php?t=822836)

fris 04-18-2008 08:50 AM

how to do a random header with css
 
I use this for one of my sites, Thought I would share

css

#header {
height:140px;
background: #fff url('images/header.php') no-repeat;
padding:0 0 0 0px;
text-align: center;
}

html

<div id="header">
</div>

php code (rename to header.php)

http://alistapart.com/d/randomizer/rotate.txt

enjoy

:thumbsup

Jens Van Assterdam 04-18-2008 09:00 AM

How to hotlink a image
 
<a href="http://galleries.penthouse.com/g/0536/21/?gpid=g950494-pct"><img src="http://www.jensvanassterdam.com/posts/152/karl.jpg" alt="Karlie Montana" target="blank"/> </a>

Use this at one of my sites..
thought i would share

mrkris 04-18-2008 09:05 AM

Why not just have an array of images and use:

<?php
srand((float) microtime() * 1000000);
$images = array('image1', 'image2', 'image3', ....);
echo $images[array_rand($images)];
?>

Or you could use javascript.

fris 04-18-2008 09:16 AM

Quote:

Originally Posted by mrkris (Post 14084108)
Why not just have an array of images and use:

<?php
srand((float) microtime() * 1000000);
$images = array('image1', 'image2', 'image3', ....);
echo $images[array_rand($images)];
?>

Or you could use javascript.

I was using it in a wordpress theme where it required it to be in css and a div

k0nr4d 04-18-2008 09:49 AM

Quote:

Originally Posted by Fris (Post 14084069)
I use this for one of my sites, Thought I would share

css

#header {
height:140px;
background: #fff url('images/header.php') no-repeat;
padding:0 0 0 0px;
text-align: center;
}

html

<div id="header">
</div>

php code (rename to header.php)

http://alistapart.com/d/randomizer/rotate.txt

enjoy

:thumbsup

That could will cause high server load because its using GD. I would just do something like

<?php
Header("Content-Type: image/jpeg");
$images = array('img1.jpg','img2.jpg','img3.jpg');
shuffle($images);
$string = file_get_contents('headers/'.$images[0]);
echo $string;
exit();
?>

payd2purv 04-18-2008 09:54 AM

Quote:

Originally Posted by k0nr4d (Post 14084249)
That could will cause high server load because its using GD. I would just do something like

<?php
Header("Content-Type: image/jpeg");
$images = array('img1.jpg','img2.jpg','img3.jpg');
shuffle($images);
$string = file_get_contents('headers/'.$images[0]);
echo $string;
exit();
?>

sweet. *copy >paste >save*


All times are GMT -7. The time now is 08:29 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123