Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
🎮 INDIAN PSN GIFT CARDS AVAILABLE NOW! 🎮
madukaperera
Updated:
Yesterday at 12:57 PM
🚀 Google AI PRO – 18 Months | Rs. 850 Only
lkkolla
Updated:
Monday at 4:56 PM
🔒 NordVPN Premium – 3 Months
hrdilshan
Updated:
Thursday at 8:29 PM
🚀 Microsoft Office 365 Pro Plus – Lifetime Access! 🚀
hrdilshan
Updated:
Thursday at 8:28 PM
Linkedin Premium Business / Careere /Sales Navigator - 1/2/3/6/9/12 Months - Reddem Link
hrdilshan
Updated:
Thursday at 8:27 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Software Development
Small php Script`s
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="MaD-DoC" data-source="post: 1129768" data-attributes="member: 56284"><p><strong>RANDOM IMAGE SCRIPT</strong></p><p></p><p><strong>RANDOM IMAGE SCRIPT</strong></p><p><strong></strong></p><p><strong></strong></p><p>First create a <strong>folder</strong> called image.gif and upload your images to it. </p><p>When you have done that, make a file in that folder called index.php and add this code.</p><p></p><p>[PHP]<?php</p><p></p><p> $folder = '.';</p><p></p><p> $extList = array();</p><p> $extList['gif'] = 'image/gif';</p><p> $extList['jpg'] = 'image/jpeg';</p><p> $extList['jpeg'] = 'image/jpeg';</p><p> $extList['png'] = 'image/png';</p><p> </p><p>$img = null;</p><p></p><p>if (substr($folder,-1) != '/') {</p><p> $folder = $folder.'/';</p><p>}</p><p></p><p>if (isset($_GET['img'])) {</p><p> $imageInfo = pathinfo($_GET['img']);</p><p> if (</p><p> isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&</p><p> file_exists( $folder.$imageInfo['basename'] )</p><p> ) {</p><p> $img = $folder.$imageInfo['basename'];</p><p> }</p><p>} else {</p><p> $fileList = array();</p><p> $handle = opendir($folder);</p><p> while ( false !== ( $file = readdir($handle) ) ) {</p><p> $file_info = pathinfo($file);</p><p> if (</p><p> isset( $extList[ strtolower( $file_info['extension'] ) ] )</p><p> ) {</p><p> $fileList[] = $file;</p><p> }</p><p> }</p><p> closedir($handle);</p><p></p><p> if (count($fileList) > 0) {</p><p> $imageNumber = time() % count($fileList);</p><p> $img = $folder.$fileList[$imageNumber];</p><p> }</p><p>}</p><p></p><p>if ($img!=null) {</p><p> $imageInfo = pathinfo($img);</p><p> $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];</p><p> header ($contentType);</p><p> readfile($img);</p><p>} else {</p><p> if ( function_exists('imagecreate') ) {</p><p> header ("Content-type: image/png");</p><p> $im = @imagecreate (100, 100)</p><p> or die ("Cannot initialize new GD image stream");</p><p> $background_color = imagecolorallocate ($im, 255, 255, 255);</p><p> $text_color = imagecolorallocate ($im, 0,0,0);</p><p> imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color);</p><p> imagepng ($im);</p><p> imagedestroy($im);</p><p> }</p><p>}</p><p></p><p>?>[/PHP]</p><p></p><p></p><p><strong>Now by linking to yoursite.com/image.gif (image.gif being the folder) the index file will automatically run and random images will be displayed. That means you can display random images in forums like these.</strong></p></blockquote><p></p>
[QUOTE="MaD-DoC, post: 1129768, member: 56284"] [b]RANDOM IMAGE SCRIPT[/b] [B]RANDOM IMAGE SCRIPT [/B] First create a [B]folder[/B] called image.gif and upload your images to it. When you have done that, make a file in that folder called index.php and add this code. [PHP]<?php $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); } } ?>[/PHP] [B]Now by linking to yoursite.com/image.gif (image.gif being the folder) the index file will automatically run and random images will be displayed. That means you can display random images in forums like these.[/B] [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom