imgopt's People
Forkers
honktang tripflex redacom mwarkentin morristech oilwell7 bytespider pcraum pje lastravex datr david-rahrer cloudxtreme tnexperts bdlabs andrewnimmoimgopt's Issues
Can't run imgopt within php script
Hi kormac, I look forward to trying your software.
I need to run imgopt within a php script. I tried the following but had no joy, can you help please?
<?php
$target_dir = "../images/";
$newFileName = basename($_FILES["fileToUpload"]["name"]);
$target_dir = escapeshellarg($target_dir);
$newFileName = escapeshellarg($newFileName);
system("imgopt $newFileName $target_dir");
?>
stat -c illegal option in bash on mac os x mountain lion
Previous version of imgopt doesn't have the issue.
Here's the console output with the new version:
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
Optimizing with advpng...
Optimizing with optipng...
Optimizing with pngout...
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
app/assets/images/teach/promo_center_header.png unchanged at bytes
/usr/local/bin/imgopt: line 65: stat_file_size_diff*100/STAT_FILE_SIZE_START: division by 0 (error token is "T")
Add official "release" tag for v0.1.4
I use imgopt a lot and I'd like to create a brew formula for it, but the homebrew peoples' guidelines require a tarball generated from a version tag.
Any way we could add release tags for the current version (v0.1.4
)?
imgopt stops on new optipng
Using the latest version of optipng (optipng-0.6.4-1.el6.i686.rpm) on Centos6, the imgopt script just halts when it reaches that stage on PNGs. I tried the options you are using on the command line with optipng on a sample image and it likewise just froze - no errors or other messages. Using optipng with no option flags worked.
I'm not sure which option is causing the issues, but that would seem to be it.
Edit: I apologize, that is obviously not the latest version of optipng. I'm having a hard time finding the i686 version of 7.4 for Centos 6. I really wish I was working on a Debian based system! If you want to leave this open, I'll report back. Otherwise, I imagine it will work with the current version. Thanks.
Edit: Ok, installed optipng 0.7.4 from source and it does exactly the same thing. Let me know if you need me to check anything.
How to use ? Incomplete Doc
I've tried to use your script.
I am not very familiar with shell script.
The script didn't ouput nothing nor doe the size of the file seems to have changed.
I don't know how I can debug, and how I can rue in verbose mode.
A clue for you, I have this
sh -x imgopt + STAT_FILE_COUNT=0 + STAT_FILE_SIZE_START=0 + STAT_FILE_SIZE_END=0 + TMPF= + interactive=0 + + interactive=1 + set -o nounset + + set -o errexit + set -otty pipefail -s imgopt: 31: set: Illegal option -o pipefail
'stat' format options are different on BSD / Mac OS X
The --format
and -c
options don't work on BSD stat
. Instead you should use -f
with a different format syntax.
At https://github.com/kormoc/imgopt/blob/master/imgopt#L99-L101 you should check what version of stat
you have.
Be aware that BSD doesn't support --version
either -- you should use something like stat --version &>/dev/null; [[ $! ]] || echo 'This is BSD!'
Then if you are on BSD you should substitute:
stat --format=%a $1
withstat -f %p $1
stat -c %U $1
withstat -f %Su $1
stat -c %G $1
withstat -f %Sg $1
Print some information about progress
Since the elaboration can take some time, it would be useful to print some information about what the script is doing, to lat the user know that it's not hanged. Something like "Doing png optimization with ..." would be sufficient.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.