Jump to content

Recommended Posts

I have a GD script that, if $_GET rebuild == true, it will regenerate the image based on database data. If not, it gets a saved image and displays that.

 

All of that works perfectly. The problem I am having is that I want one script that will run all of my rebuilds at once. However, when require()ing or include()ing the scripts that generate the image, it tells me that it cannot find the file. It can find them when I don't have ?rebuild=true, but then it doesn't update them.

 

The code:

<?php
$maps = array();
if ($handle = opendir('.')) {
    while (false !== ($file = readdir($handle))) {
        if (is_file($file) && !in_array($file, array("error_log", "update.php"))) {
            $maps[] = "$file";
        }
    }
    closedir($handle);
}

for($i = 0; $i < count($maps); $i++)
{
echo "$maps[$i]";
include($maps[$i] . "?rebuild=true");
}
?>

 

Is there any other way to do this? I want it all in one file so I can update all my images with one cron job. This means I can't use <img src="map url"> because the cron job would close it off before the php scripts were done, since the cron-called script is finished.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.