protected function img() {
		foreach ($this->localStatic[ __FUNCTION__ ] as $imgDir) {
			//if(is_file($imgDir . DIRECTORY_SEPARATOR . 'Thumbs.db'))
			//	unlink($imgDir . DIRECTORY_SEPARATOR . 'Thumbs.db');
			/*
			  $this->start('Optimizing '. $imgDir)
			  ->runLocal([
			  self::IMGMIN,
			  '-o', 7,
			  $imgDir,// . DIRECTORY_SEPARATOR. '*',
			  $this->localStatic . 'img'
			  ])->finish();
			 */
			foreach (self::rglob($imgDir . DIRECTORY_SEPARATOR . '*.{jpg,jpeg,png,gif,svg,bmp}', GLOB_BRACE) as $image) {
				$output = $this->tmp[ __FUNCTION__ ] . substr($image, strlen($imgDir) + 1);
				self::readyDir($output);


				if ($this->compress)
					$this->start('Optimizing ' . $image)
							->runLocal(['imagemin',
								//'-o', 7,
								$image,
								'>',
								$output
							])->finish();
				else
					copy($image, $output); // symlink
			}
		}
		
		return $this;
	}
protected function img() {
		foreach ($this->localStatic[ __FUNCTION__ ] as $imgDir) {
			//if(is_file($imgDir . DIRECTORY_SEPARATOR . 'Thumbs.db'))
			//	unlink($imgDir . DIRECTORY_SEPARATOR . 'Thumbs.db');
			/*
			  $this->start('Optimizing '. $imgDir)
			  ->runLocal([
			  self::IMGMIN,
			  '-o', 7,
			  $imgDir,// . DIRECTORY_SEPARATOR. '*',
			  $this->localStatic . 'img'
			  ])->finish();
			 */
			foreach (self::rglob($imgDir . DIRECTORY_SEPARATOR . '*.{jpg,jpeg,png,gif,svg,bmp}', GLOB_BRACE) as $image) {
				$output = $this->tmp[ __FUNCTION__ ] . substr($image, strlen($imgDir) + 1);
				self::readyDir($output);


				if ($this->compress)
					$this->start('Optimizing ' . $image)
							->runLocal(['imagemin',
								//'-o', 7,
								$image,
								'>',
								$output
							])->finish();
				else
					copy($image, $output); // symlink
			}
		}
		
		return $this;
	}
protected function img ( ) { foreach ( $ this -> localStatic [ __FUNCTION__ ] as $ imgDir ) { //if(is_file($imgDir . DIRECTORY_SEPARATOR . 'Thumbs.db')) //	unlink($imgDir . DIRECTORY_SEPARATOR . 'Thumbs.db'); /*
			  $this->start('Optimizing '. $imgDir)
			  ->runLocal([
			  self::IMGMIN,
			  '-o', 7,
			  $imgDir,// . DIRECTORY_SEPARATOR. '*',
			  $this->localStatic . 'img'
			  ])->finish();
			 */ foreach ( self :: rglob ( $ imgDir . DIRECTORY_SEPARATOR . '*.{jpg,jpeg,png,gif,svg,bmp}' , GLOB_BRACE ) as $ image ) { $ output = $ this -> tmp [ __FUNCTION__ ] . substr ( $ image , strlen ( $ imgDir ) + 1 ) ; self :: readyDir ( $ output ) ; if ( $ this -> compress ) $ this -> start ( 'Optimizing ' . $ image ) -> runLocal ( [ 'imagemin' , //'-o', 7, $ image , '>' , $ output ] ) -> finish ( ) ; else copy ( $ image , $ output ) ; // symlink } } return $ this ; }
Move images to upload dir
Optimize them if needed
Move images to upload dir Optimize them if needed