Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-12-2010, 03:34 PM   #1
Ad-Min
Confirmed User
 
Ad-Min's Avatar
 
Industry Role:
Join Date: Feb 2010
Posts: 655
Looking for a random image script in PHP

Hi guys,i am looking for a random image script in php.
I´ve checked many sites but i am not able to find what i am looking for.
I would like to rotate a couple of thumbs from a folder randomly.
I have about 20 folders and all the thumbs should go on one page.
Actualy 20 rotating thumbs on the page (20 folders x 5 thumbs per folder).
No java for now,i need it in php.
Any suggestions?

Thanks in advance
Ad-Min is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-12-2010, 03:50 PM   #2
newB
Confirmed User
 
newB's Avatar
 
Industry Role:
Join Date: Jul 2006
Location: Somewhere between reality and total ape-shit bonkers.
Posts: 2,870

Here's one I used to make a fake TGP a long time back and it worked like a charm in that it allows for link attributes. If you don't want to link the images, just leave the fields blank in the ini sheet.

http://www.alistapart.com/articles/betterrotator/
__________________

The best Adult Affiliate Programs reviewed and indexed by niche and feature.
Easily find the sponsors that suit your needs.


newB is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-12-2010, 04:53 PM   #3
Supz
Arthur Flegenheimer
 
Supz's Avatar
 
Industry Role:
Join Date: Jul 2006
Location: New York City
Posts: 11,056
Take a look at AIRS from BigDotMedia

http://www.bigdotmedia.com/airs.php
Supz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-12-2010, 05:00 PM   #4
garce
Confirmed User
 
garce's Avatar
 
Industry Role:
Join Date: Oct 2001
Location: Toronto
Posts: 7,103
You can try this is you just want something simple: http://ma.tt/scripts/randomimage/
garce is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-12-2010, 05:26 PM   #5
HomerSimpson
Too lazy to set a custom title
 
HomerSimpson's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Springfield
Posts: 13,826
rstgp or contact me to write you something custom

www.awmzone.com/services
__________________
Make a bank with Chaturbate - the best selling webcam program
Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:
HomerSimpson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-12-2010, 07:07 PM   #6
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by newB View Post
Here's one I used to make a fake TGP a long time back and it worked like a charm in that it allows for link attributes. If you don't want to link the images, just leave the fields blank in the ini sheet.

http://www.alistapart.com/articles/betterrotator/
i would use this, but a modified version so you dont have repeating images.

http://randaclay.com/tips-tools/mult...ge-php-script/
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2010, 12:07 PM   #7
Ad-Min
Confirmed User
 
Ad-Min's Avatar
 
Industry Role:
Join Date: Feb 2010
Posts: 655
Thanks a lot guys ,i would rep you all but i am not able !
Ad-Min is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2010, 12:18 PM   #8
SmellyNose
Confirmed User
 
SmellyNose's Avatar
 
Industry Role:
Join Date: Aug 2009
Location: me at smellynose.com
Posts: 206
I wrote this in the GFY quick reply box, so who knows if it has errors.
Code:
<?php
define('BASE_DIR', '/var/www/mysite/images/'); // Where are your images?
define('IMAGE_LIMIT', 10); // how many images to show?

$files     = glob(BASE_DIR.'*');
$images = Array();

if(empty($files)) {
    die("Hey, dude, there are no files. What happened?");
}

foreach($files as $v) {
    if(is_dir($v)) {
        foreach($files as $v) { // This should be a function which can loop through further sub directories if needed
            //get exif image type, if it's an image append to array
            $images[] = $v;
        }
    } else {
        $images[] = $v;
    }
}

shuffle($images); // Randomise the array
for($i=0;$i<IMAGE_LIMIT;$i++) {
    $img = $images[$i];
    if(empty($img)) {
        break; // Might be best doing a foreach above whilst keeping $i as a loop counter and breaking the loop once you reach the limit
    }
    $img_src = end(explode("/", $img));
    echo "<img src='{$img_src}'/>";
}
__________________
I'm a PHP developer - 594086663 - [email protected]
SmellyNose is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2010, 01:32 PM   #9
Ad-Min
Confirmed User
 
Ad-Min's Avatar
 
Industry Role:
Join Date: Feb 2010
Posts: 655
Quote:
Originally Posted by SmellyNose View Post
I wrote this in the GFY quick reply box, so who knows if it has errors.
Code:
<?php
define('BASE_DIR', '/var/www/mysite/images/'); // Where are your images?
define('IMAGE_LIMIT', 10); // how many images to show?

$files     = glob(BASE_DIR.'*');
$images = Array();

if(empty($files)) {
    die("Hey, dude, there are no files. What happened?");
}

foreach($files as $v) {
    if(is_dir($v)) {
        foreach($files as $v) { // This should be a function which can loop through further sub directories if needed
            //get exif image type, if it's an image append to array
            $images[] = $v;
        }
    } else {
        $images[] = $v;
    }
}

shuffle($images); // Randomise the array
for($i=0;$i<IMAGE_LIMIT;$i++) {
    $img = $images[$i];
    if(empty($img)) {
        break; // Might be best doing a foreach above whilst keeping $i as a loop counter and breaking the loop once you reach the limit
    }
    $img_src = end(explode("/", $img));
    echo "<img src='{$img_src}'/>";
}
Thanks but i have solved the problem already.
Ad-Min is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.