if (!(check_perms('users_mod') || check_perms('admin_clear_cache'))) {
error(403);
}
// If this is accessed by itself through AJAX (e.g. when already rerendering images)
if (isset($_POST['ajax']) && isset($_POST['image'])) {
if (!isset($_POST['stylesheet']) ) {
echo json_encode(array('status' => "-2"));
die();
}
//Get the actual image data from the sent data string.
$FullData = $_POST['image'];
list($type, $ImageData) = explode(';', $FullData);
list(, $Base64Data) = explode(',', $ImageData);
$Image = base64_decode($Base64Data);
//Save the image to a file
file_put_contents(STATIC_SERVER.'thumb_'.$_POST['stylesheet'].'.png', $Image);
//Check if the file got saved properly, return status message.
if (!file_exists(STATIC_SERVER.'thumb_'.$_POST['stylesheet'].'.png')) {
echo json_encode(array('status' => "-1"));
die();
} else {
echo json_encode(array('status' => "0"));
die();
}
} elseif (!isset($_POST['ajax'])) {
// If this is accessed by the administrating user, display the page (creates calls to itself through AJAX).
View::show_header('Rerender stylesheet gallery images', 'jquery,stylesheetgallery_rerender_queue');
?>
Rerender stylesheet gallery images
About rendering
You are currently rerendering the stylesheet gallery images. Please don't close this page until rendering is finished or some images may be left unrendered.
This is a processing-intensive operation; you're likely to see a spike in your CPU & RAM usage.
Tested and debugged on up-to-date Webkit and Gecko browsers; Opera will result in undefined behavior.
Important: Be sure to double-check the gallery once all rendering is finished.
Begin rendering
Rendering status
foreach ($Stylesheets as $Style) { ?>
- =$Style['Name']?>
} ?>
View::show_footer();
} else {
// Faulty operation, too many parameters or too few, error out.
error(500);
}
?>