Created
May 12, 2016 06:07
-
-
Save aaryadev/524f0aa3bb7bf8a80a78d79b4da49e7e to your computer and use it in GitHub Desktop.
reduce image size using php and shell command, convert and php is very common in ubuntu using them compress/resize the images in folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = new DirectoryIterator(dirname(__FILE__)); | |
$count=0; | |
foreach ($dir as $fileinfo) { | |
if (!$fileinfo->isDot()) { | |
$output= shell_exec('convert -resize 50% '.$fileinfo->getFilename().' '.$count.'.jpg'); | |
} | |
$count++; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment