ウェブサイト上の各ページの更新時に新しい背景イメージを表示するにはどうすればよいですか?また、さまざまな画面解像度と適切な処理についても考慮したいと思います。どんな助けでも大歓迎です。各ページの新しい背景イメージ
2
A
答えて
-1
0
、あなたは別の画像を表示するには、クライアント側のJavaScript
screen.height
screen.width
を使用することができ、あなたはおそらく生成するスクリプトを使用することができます乱数とそれに結びついた画像を表示する...?あなたは、セッション中に「現在」imaageを保存し、ちょうど最後を表示するつもりはないことをあなたは新しい乱数を生成するたびに、チェックすることができ ....
0
とリアルタイムでそれを生成することができます
1
あなたは、ワードプレスコーデックスでthis pageを見たことがありますか?
ヘッダーイメージを回転する方法について説明します。それはあなたのニーズに合わせてそれを適応させるのはあまりにも困難ではありません。
1
アクセスするたびにランダムに写真を返す独自のスクリプトを用意してください。私は下のURLにCで書いたものがあり、毎回異なる写真を返します。
0
これは私がランダムに私のサイトにヘッダー画像を回転させるためのWordpressを使用するものです。
他の誰かがコードを書いたので、誰が覚えていないのですか。以下のPHPコードをrotate.phpという名前のファイルに入れて、rotate.phpを回転させる画像のディレクトリ(つまり、 "headerimages")に置き、rotate.phpがそこから描画します。ヘッダー画像にDIVが使用されている場合でも、CSSスタイルシートからrotate.phpを呼び出します。
私はあなたが別の画面解像度を扱うことができることによって何を意味するのか理解していません。エンドユーザーの画面解像度?
<?php
/*
Call this way: <img src="http://example.com/rotate.php">
Set $folder to the full path to the location of your images.
For example: $folder = '/user/me/example.com/images/';
If the rotate.php file will be in the same folder as your
images then you should leave it set to $folder = '.';
*/
$folder = '.';
$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';
$img = null;
if (substr($folder,-1) != '/') {
$folder = $folder.'/';
}
if (isset($_GET['img'])) {
$imageInfo = pathinfo($_GET['img']);
if (
isset($extList[ strtolower($imageInfo['extension']) ]) &&
file_exists($folder.$imageInfo['basename'])
) {
$img = $folder.$imageInfo['basename'];
}
} else {
$fileList = array();
$handle = opendir($folder);
while (false !== ($file = readdir($handle))) {
$file_info = pathinfo($file);
if (
isset($extList[ strtolower($file_info['extension']) ])
) {
$fileList[] = $file;
}
}
closedir($handle);
if (count($fileList) > 0) {
$imageNumber = time() % count($fileList);
$img = $folder.$fileList[$imageNumber];
}
}
if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
} else {
if (function_exists('imagecreate')) {
header ("Content-type: image/png");
$im = @imagecreate (100, 100)
or die ("Cannot initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 0,0,0);
imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color);
imagepng ($im);
imagedestroy($im);
}
}
?>
これを行う方法は無限にあります。特定の方法がありますか? – Welbog
サーバーへの負荷が最小で、すべてのブラウザで機能する方法 –
異なるスクリーンresoultionsとはどういう意味ですか?エンドユーザーの画面解像度?どのように/なぜ彼らはこの場合重要ですか?下の私の答えを見てください。 – markratledge