Easiest Solution For Auto Updating Images Using My Current PHP Script?

ycfme

Power Member
Joined
Mar 24, 2010
Messages
780
Reaction score
66
Hey Guys,

So I actually have that same script as this site
HTML:
hxxp://onlinebikinibabes.com
. However, it does not automatically update fresh images on it's own. I'd like to place images in a queue, which would then in turn update fresh images several times daily.

Any idea what kind of script/code that would do this?

I'm not a coder or anything so the simpler the better.

Thanks!:hello:
 
Are you looking to add new images each day, or just change them around so they appear in different places?
 
Hi, Thanks for responding.

I'd like to add "new images" Seeing that I have over 20k images i'm sure even if the script fetched images by groups of 10-20 images each day i would still have plenty of room for shuffling images around.

I would prefer to not have images reappearing, before cycling throughout the entire folder of images.

Any ideas?

Are you looking to add new images each day, or just change them around so they appear in different places?
 
If you have access to cron, it would be the most efficient.
 
Been discussing this by PM, but will post code here in case anyone else finds it useful.

Create a new folder to hold your images and set the permission to 777 so the images can be deleted after they are copied to the other folder.

Code:
<?php
$in_dir = 'queue/';  // From directory
$out_dir = 'images/'; // To directory
$indir = dir($in_dir);
$dirlist = array();
while ($file = $indir->read()) { // read filenames
  if(0 != strpos($file, '.jpg')) // if filename has .jpg in it
      $dirlist[] = $file;        // add to array
}
$indir->close();
$howmany = rand(10,20);  // move from 10 to 20
$images = array_slice($dirlist, 0, $howmany);
foreach ($images as $curr) {
  if (copy("$in_dir$curr","$out_dir/$curr")) {
    unlink("$in_dir/$curr");
    }
  }

You can change the number of images to be copied each time on the line that sets $howmany. Here I have it randomly choosing between 10 and 20. It should copy the images in the same order that they were put into the folder.
 
Sorry 4 the hijack but how did u get the images to begin with? Scrape the net?
 
No prob... Let's just say I love chicks :p

There are TONS of sites/forums etc. out there for images. You can even take your own (I do on occasion...)

Sorry 4 the hijack but how did u get the images to begin with? Scrape the net?
 
Back
Top