Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About lefreak

  • Rank
  1. Hi Guys, I would like to implement a loading spinner when a button is clicked and a function is called to run a script in the background, just not sure how to do it. If possible I would like to keep it a simple css spinner if possible. My code looks like <div class="col-md-12 text-center" id="sync"> <button type="button" class="btn btn-primary" onclick="loadDoc()">Click here to synchronise</br>live stock quantities</button> </div>
  2. ok for anyone still following this topic I was on the completely wrong side of the tracks lol I changed the function completely to this and now it works as expected by removing the url in the array and leaving only the filename behind. function clear_string_from_characters( $string ) { $search = array( 'http://www.mysite.co.uk/store/images/', ); $replace = ''; return str_replace( $search, $replace, $string ); }
  3. I am trying to remove the tld from the url and leave only the filename
  4. I think I have narrowed it down to the clean urls function which is not just removing the url from the string but the entire string including the filename. I dont fully understand the contents of the preg_match. Eg. http://my-site.com/gifts/images/my-image.jpg I require the function to remove http://my-site.com/gifts/images/ and leave only the filename help would be appreciated as its got me stumped 😖 function containsTLD($string) { preg_match( "/(AC($|\/)|\.AD($|\/)|\.AE($|\/)|\.AERO($|\/)|\.AF($|\/)|\.AG($|\/)|\.AI($|\/)|\.AL($|\/)|\.AM($|\/)|\.AN($|\/)|\.AO($
  5. Sorry to bump but can anyone offer any help? Thanks
  6. Can anyone help with this problem as I have tried various things which either killed the script or did not work. Thanks
  7. thank you for the easy to understand help I am now not receiving any errors and the script is running however it is only retrieving 1 image and saving it in the folder as .jpg with out the name which is causing the script to report the image already exists. I added a function to clean the url from the image name before saving so not sure if that is what is causing the problem. <?php /* settings */ //folder for images saving $saveDir = "c:/wamp64/www/script/images/"; //database connection // Turn off all error reporting //error_reporting(0); $conn = mysqli_connect('localhost', 'ro
  8. no need to be sorry, every little helps thank you do you mean ) or } this is the code now as it stands while ($row = $res->fetch_assoc()) { $url = $row(['image_url']); $dest = $saveDir . clean($row(['image_url'])) . '.jpg'; if (!file_exists($dest)) { //prevent file overwriting if (copy($url, $dest)) { $notify.= 'image saved: '. $row(['image_url']); $count++; } else { $notify.= 'ERROR saving image: '. $row(['image_url']); } } else { $notify.= 'image already exists: '. $row(['image_url']); } }
  9. thank you for helping previously Barand. I am now receiving this error which is this line $url = $row(['image_url']);
  10. I did think of that but still throws the error
  11. Thanks Barand, total rookie miss lol Also getting this error now which is the second }else{ if (!file_exists($dest)){ //prevent file overwriting if (copy($url, $dest)){ $notify.= 'image saved: '. $row(['image_url']); $count++; }else{ $notify.= 'ERROR saving image: '. $row(['image_url']); }else{ $notify.= 'image already exists: '. $row(['image_url']); } }
  12. Hi Guys, I have an issue with the following script which is throwing this error I just can not see the error, can anyone help (not even sure the script is going to work) <?php /* settings */ //folder for images saving $saveDir = "c:\wamp64\www\script\images\"; //database connection // Turn off all error reporting error_reporting(0); $conn = mysqli_connect('localhost', 'root', '', 'tbl_temp_products'); //start and end table row to prevent timeout or hard server work $start = '1'; $end = '200'; /* end of settings */ //query for fetching the image urls $sql = 'SELECT image
  • 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.