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:34 AM
Views: 38
Tags: car leasing
  1. <?php
  2.  
  3. require_once($_SERVER['DOCUMENT_ROOT'] . '/system/bootstraps/public.inc.php');
  4.  
  5. ini_set('max_execution_time', 30 * 60);
  6.  
  7. use WebPConvert\WebPConvert;
  8.  
  9. /*
  10. $dir_location = dirname(__FILE__) . '/userfiles/hero-make/';
  11. $dir = new DirectoryIterator($dir_location);
  12. foreach ($dir as $fileinfo) {
  13.     if (!$fileinfo->isDot() && $fileinfo->getBasename() !== '.DS_Store') {
  14.         $source = $dir_location . $fileinfo->getFilename();
  15.         echo $source;
  16.         $destination = $source . '.webp';
  17.         $options = [
  18.             'jpeg' => [
  19.                 'max-quality' => 100,
  20.                 'default-quality' => 90,
  21.             ]
  22.         ];
  23.         WebPConvert::convert($source, $destination, $options);
  24.     }
  25. }
  26.  
  27. $dir_location = dirname(__FILE__) . '/userfiles/hero-fallback/';
  28. $dir = new DirectoryIterator($dir_location);
  29. foreach ($dir as $fileinfo) {
  30.     if (!$fileinfo->isDot() && $fileinfo->getBasename() !== '.DS_Store') {
  31.         $source = $dir_location . $fileinfo->getFilename();
  32.         echo $source;
  33.         $destination = $source . '.webp';
  34.         $options = [
  35.             'jpeg' => [
  36.                 'max-quality' => 100,
  37.                 'default-quality' => 90,
  38.             ]
  39.         ];
  40.         WebPConvert::convert($source, $destination, $options);
  41.     }
  42. }
  43. $dir_location = dirname(__FILE__) . '/userfiles/hero-range/';
  44. $dir = new DirectoryIterator($dir_location);
  45. foreach ($dir as $fileinfo) {
  46.     if (!$fileinfo->isDot() && $fileinfo->getBasename() !== '.DS_Store') {
  47.         $source = $dir_location . $fileinfo->getFilename();
  48.         echo $source;
  49.         $destination = $source . '.webp';
  50.         $options = [
  51.             'jpeg' => [
  52.                 'max-quality' => 100,
  53.                 'default-quality' => 90,
  54.             ]
  55.         ];
  56.         WebPConvert::convert($source, $destination, $options);
  57.     }
  58. }
  59.  
  60.  
  61. $dir_location = dirname(__FILE__) . '/userfiles/hero/';
  62. $dir = new DirectoryIterator($dir_location);
  63. foreach ($dir as $fileinfo) {
  64.     if (!$fileinfo->isDot() && strpos($fileinfo->getFilename(), "n_") !== FALSE) {
  65.         $source = $dir_location . $fileinfo->getFilename();
  66.         echo $source;
  67.         $destination = $source . '.webp';
  68.         $options = [
  69.             'jpeg' => [
  70.                 'max-quality' => 100,
  71.                 'default-quality' => 80,
  72.             ]
  73.         ];
  74.         WebPConvert::convert($source, $destination, $options);
  75.     }
  76. }
  77. */