Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Rob Sa
Added: Sep 10, 2020 6:29 AM
Views: 38
Tags: car leasing
  1. <?
  2. $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__) . '/../..';
  3. require_once($_SERVER['DOCUMENT_ROOT'] . '/system/bootstraps/global.inc.php');
  4. //error_reporting(E_ALL);
  5. ini_set('max_execution_time', 60 * 60 * 5);
  6. ini_set('memory_limit', '1024M');
  7.  
  8. $vehicleDeals = new deals($db);
  9. $cms = new cms($db, $vehicleDeals);
  10.  
  11. // find media
  12. if($_GET['id']) {
  13.     $cms->createImagesFromFile("media", "https://www.motorlet.co.uk/userfiles/vehicles/o_" . $_GET['id'] . ".jpg", $_GET['id']);
  14.     $db->query("UPDATE media SET done = 1 WHERE id = " . $_GET['id']);
  15.     echo 'DONE ' . $_GET['id'] . "; ";
  16. } else {
  17.     $rs = $db->query("SELECT * FROM media WHERE type = 'image' AND deleted = 0 AND done = 0 ORDER BY id LIMIT 2500");
  18.     while($image = $db->fetch_assoc($rs)) {
  19.         if($cms->createImagesFromFile("media", "https://www.motorlet.co.uk/userfiles/vehicles/o_" . $image['id'] . ".jpg", $image['id'])) {
  20.             $db->query("UPDATE media SET done = 1 WHERE id = " . $image['id']);
  21.             echo 'DONE ' . $image['id'] . "; ";
  22.         }
  23.     }
  24. }
  25.