Eğer bir internet siteniz varsa buraya tıklayın.Sitenizi netbuu toplist'e kaydettirin kârlı çıkın.Şimdi kaydetmek için tıklayın.
Php ile rastgele fotoğraf gösterme - Php ile sayfa her yenilemede rastgele belirlediğini fotoğrafları göstermek içinkullanabileceğiniz bir hazır kod uygulamadır.
Arama
  |   Hazır Kodlar   |   Hazır Kod Ekle   |   Giris Sayfasi Yap   |   Sık Kullanılanlara Ekle
Üye Adı
Şifre
// Webmaster Araçları
 Google Pagerak Ölçümü
 Link Populerliği Kontrol
 Arama Motorlarına Kayıt
 Webte Kelime Arama
 .htaccess Dosyası Oluştur
 .htpasswd Dosyası Oluştur
 Domain Sorgulama
 Md5-Md4-Sha1 Kodla
 Metatag Oluştur
 Html Kodlarını Şifreleyin
 Popup Yapım Aracı
 Html-Php Uyumu Sağla
 Html-Asp Uyumu Sağla
 Html-JS Uyumu Sağla
 Byte-Kb-Mg-Gb dönüştürücü
 Buton Oluştur
 Zaman Çevirici
 Tarayıcıya Göre Yönlendirme
 Çözünürlüğe Göre Yönlendirme
 Css Yapım Aracı
 Scroolbar Yapım Aracı
 İp-Port-Sistem Bilgileriniz
 El Yazısı
 JavaScript Encode-Decode
// Siteniz İçin İçerik
 Son Depremler
 Sayısal Loto Sonuçları
 Altın Fiyatları
 Güzel Söz
 Domain Sorgulama
 Hava Durmu Kod'u
 Döviz Kurlari Kod'u
 Pagerank Sorgulama
 Son Eklene Kodlar
 Takvim Uygulaması
 Günlük Burç Yorumu
 Yol Durumu Bilgileri
Hazır Kod Detayları

Php ile rastgele fotoğraf gösterme
Php ile sayfa her yenilemede rastgele belirlediğini fotoğrafları göstermek içinkullanabileceğiniz bir hazır kod uygulamadır.

//****************** SCRIPT INFORMATION *****************\
|| Basic Image Randomizer v-1.1 ||
|| Copyright (C) 2005-2007 Brandon Heyer ||
|| brandonheyer@gmail.com ||
\********************************************************//

//********************* UPDATE LOG *********************\
|| June 03, 2007 --- version 1.1 Released ||
|| - Added $GLB_IMAGE global for accessing address of ||
|| randomized image. ||
|| July 11, 2005 --- version 1.0 Released ||
\********************************************************//

//******************** INSTRUCTIONS ********************\
|| 1. Upload "basic_image_randomizer.php" to the same ||
|| directory as the page you would like to have a ||
|| randomized image on. ||
|| ||
|| 2. Copy and paste the following line into the page ||
|| which will contain the randomized image (at the ||
|| top of the page is fine): ||
|| <? include("basic_image_randomizer.php"); ?> ||
|| ||
|| 3. Copy, paste and edit the following line into the ||
|| image tag where the random image will be displayed ||
|| /<? imageRandom('dir/of/images/', 'types'); ?> ||
|| Replace the "dir/of/images/" with the directory ||
|| where the images are located. Replace types based ||
|| off the following criteria: ||
|| '' --- All images (be warned this will actually ||
|| draw from all the files so make sure ||
|| that only images are located in the dir ||
|| 'jpg' All jpg images ||
|| 'gif' All gif images ||
|| 'png' All png images ||
|| 'jpg,gif,png' (or any combination of two) ||
|| This will yeild all images that have the ||
|| specified extensions. ||
|| ||
|| Any other extension may also be used, but results ||
|| may not be as expected, so it is best to stick to ||
|| the three main web image extensions. ||
|| An example of properly edited and inserted ||
|| code would be: ||
|| ||
|| <img src='/<? imageRandom('img/', 'png,jpg'); ?>' /> ||
|| NOTE: Due to possible server differences you may or ||
|| may not need the forwards slash located between ||
|| the ' and the < (src='/<). If it doesn't work ||
|| with the slash, remove it and reupload. ||
|| ||
|| This will randomly select an image that is either ||
|| a 'png' or 'jpg' from the directory img/ ||
|| ||
|| 4. (OPTIONAL) If you would like to output the image's ||
|| address for display on the page, or inclusion in ||
|| an <a> tag, place the following where you would ||
|| like to have the image's address printed: ||
|| ||
|| <? echo $GLB_IMAGE; ?> ||
|| Example of usage: ||
|| <a href='<? echo $GLB_IMAGE; ?>'>Click to view</a> ||
|| ||
|| 5. Make sure the file is saved with as a ".php" file ||
|| otherwise the script will not work. ||
|| ||
|| 6. Upload the file and view! ||
\********************************************************//
---------------------------------------------------------------------------------
Kod.
<?

//**************************************//
// BASIC IMAGE RANDOMIZER v-1.1 //
// COPYRIGHT (C) 2005 BRANDON HEYER //
// brandonheyer@gmail.com //
//**************************************//

//Global string which contains the address of
// the random image. Can be used for linking
// to the image, etc.
$GLB_IMAGE;

function imageRandom($dir, $types) {

$images = array();
$new = array();

global $GLB_IMAGE;

if ( !empty($types) ) {
$types = explode(",", $types);
foreach ( $types as $t ) {
$glob = $dir . '*.' . $t;
$new = glob( $glob );
if ( !empty( $new ) ) {
$images = (array)$new + (array)$images;
}
}
} else {
$images = glob( $dir . '*.*' );
}

$key = array_rand($images);
$image = $images[$key];
$GLB_IMAGE = $image;

echo $image;
}

?>
------------------------------------------------------------------
Kullanımı.
<? include("basic_image_randomizer.php"); ?>
<h2 class="center">Basic Image Randomizer Sample</h2>
<p class="center">
<img src="/<? imageRandom('php/basic_image_randomizer/', 'jpg,png'); ?>" /><br />
The address of this image is <? echo $GLB_IMAGE; ?>.<br />
<a href="?">Refresh!</a><br />
</p>
Kodu
basic_image_randomizer.php isminde bir dosyaya kaydediniz.

Ekleyen:  kurucu    Ekleme Tarihi  21/08/2008 03.37.16    Gösterim Sayısı:  74    Tavsiye    Örneği Göster
Bu Başlığa Link Vermek İçin
1 netbuu