Coder Social home page Coder Social logo

tylerhall / autosmush Goto Github PK

View Code? Open in Web Editor NEW
121.0 121.0 23.0 61 KB

Losslessly compresses images in your Amazon S3 buckets on-the-fly.

Home Page: http://clickontyler.com/blog/2010/10/automatically-compressing-your-amazon-s3-images-using-yahoos-smush-it-service/

PHP 100.00%

autosmush's People

Contributors

dprvig avatar mileszs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

autosmush's Issues

AWS SDK for PHP 2.x Support

Hi Tyler,

Thanks for this awesome tool! I really appreciate your hard work. My question is, will you be updating this to work with the new SDK? If not, it would be good to be sure to link from your Readme the page to download the 1.6.x version of the SDK, as it took me a bit to figure out I was using the wrong version of the SDK. (It can be found here:http://aws.amazon.com/releasenotes/PHP/4051273386766049)

Anyway, thanks for this great tool!

Syntax Error

I'm getting a syntax error when I try to run this script:

Parse error: syntax error, unexpected ',', expecting '(' in /path/to/autosmush on line 120

Any idea why? I'm running PHP 5.2.5 (cli)

Help

I am gettin this error when i run the code as :

[root@* smush]# php autosmush s3-bucket name

KIPPED: 0204c4b4-3727-4fa6-ac62-40ff57201b06.jpg already smushed
NOT SMUSHED: 0204fe99-b90c-468a-b1ff-79746502c482.jpg already compressed
PHP Fatal error: Couldn't find implementation for method CFArray::getiterator in Unknown on line 0

What is problem. I use PHP 5.3.28 as version

getting 'ERROR: Could not download' error.... issue with fopen options.

First of all, i'd like to thank you for writing this awesome tool. Looks very useful for my project.

However, when i try to run the script, i get an error saying that the smushed version of the file could not be downloaded. When i checked, i saw that the files created in the /tmp folder have different names from what is expected by the script. They seem to have 6 characters appended to them.. 'smushxyzxyz'. Any idea why this is happening and how to fix this.

FYI.. my server runs rails. So i just installed PHP5, php-curl, the aws sdk and restarted apache. Is there anything else that i should've done here?

root@kettik:/autosmush# ./autosmush kettik_development
SMUSHED: articles/1/coverimgs/c43290a2662ff8fe9fcfe8c352a007bb_cover.jpg (42.50%)
ERROR: Could not download smushed version of articles/1/coverimgs/c43290a2662ff8fe9fcfe8c352a007bb_cover.jpg
SMUSHED: articles/1/coverimgs/c43290a2662ff8fe9fcfe8c352a007bb_original.jpg (41.76%)
ERROR: Could not download smushed version of articles/1/coverimgs/c43290a2662ff8fe9fcfe8c352a007bb_original.jpg
SMUSHED: articles/1/coverimgs/c43290a2662ff8fe9fcfe8c352a007bb_small.jpg (66.75%)
^C
root@kettik:
/autosmush# ls /tmp
passenger.1.0.9956 smushOuXAXx smushPjBKz6 smushqgoJD5

Error: Unable to retrieve bucket contents.

Hi,

I am getting following error when I am trying to autosmush my s3 bucket,

Error: Unable to retrieve bucket contents.

What can be the reason for this error? Are some configurations in s3 console required to get autosmush to work?

Is this project still active?

Hi,

Just wanting to know if this project is active and proven to still work even though the last commit was years ago?

Suggestion : Delete the /tmp file after uploading the smushed file to S3

The script works great for me now. But one issue i found was that the temp files created in the /tmp folder are not deleted. So i added the 'unlink($tmp_filename);' command after the s3 object was updated to delete the temporary file.

The change is working fine for me. I suggest you update the 'official' script as well.

Instructions update ? no sdk-x.x.x folder ?

The file's instructions say to unzip AWS SDK for php and copy the sdk-x.x.x folder and rename to sdk in lib for autosmush but there's no sdk-x.x.x folder when i unzip SDK 1.6.2 ?

-rw-r--r--  1 root root  124 Mar 15  2013 .gitignore
-rw-r--r--  1 root root 9.5K Mar 15  2013 README.md
drwxr-xr-x  2 root root 4.0K Mar 15  2013 _compatibility_test
drwxr-xr-x  2 root root 4.0K Mar 15  2013 _docs
drwxr-xr-x  5 root root 4.0K Mar 15  2013 _samples
drwxr-xr-x  2 root root 4.0K Mar 15  2013 authentication
-rw-r--r--  1 root root  762 Mar 15  2013 composer.json
-rwxr-xr-x  1 root root 3.4K Mar 15  2013 config-sample.inc.php
drwxr-xr-x  2 root root 4.0K Mar 15  2013 extensions
drwxr-xr-x  6 root root 4.0K Mar 15  2013 lib
-rwxr-xr-x  1 root root  49K Mar 15  2013 sdk.class.php
drwxr-xr-x  2 root root 4.0K Mar 15  2013 services
drwxr-xr-x  2 root root 4.0K Mar 15  2013 utilities

URL Encoding Issue For Files with Spaces

As of today, the smush.it api endpoint expects all spaces in file name to be URL encoded pluses (%2B).

e.g.:
Image Name = image with spaces.png

This returns null:
http://www.smushit.com/ysmush.it/ws.php?img=http://s3.amazonaws.com/BUCKET/image%20with%20spaces.png

This returns the expected response:
http://www.smushit.com/ysmush.it/ws.php?img=http://s3.amazonaws.com/BUCKET/image%2Bwith%2Bspaces.png

  1. The Autosmush library does not URL encode the image file path at all before calling CURL
  2. The special case of replacing spaces with plusses needs to be added before URL encoding

Never smushed before and I am getting "SKIPPED: image/src.jpg already smushed"

I am running the script locally and connecting to my S3 account by following the directions, it seems to have passed header files to all the files, but when I go to smushit and upload the same files they aren't compressed, just the header part is changed. Wondering how I can remove the header file and smush or force smush, any idea?

Error: Unable to retrieve bucket contents.

Hi,
I have an
Error: Unable to retrieve bucket contents. on ./autosmush subdomain.domain.com

The name of bucket is a subdomain because i have enabled website hosting for get images by subdomain.domain.com

Thanks

bash: ./autosmush: Permission denied

I am getting following error on trying to run

./autosmush my.bucket

Error:

bash: ./autosmush: Permission denied

What can be the reason of this error? I have entered AWS S3 access key and secret key in autosmush file.

OMG this is amazing

Thank you for this. I have one question, is the Smushit integration official or just a hack? Seems hacked from the ajax interface, i don't care. I just wish Yahoo would make it official so this doesn't break out of the blue.

Undefined Fuction

I'm getting this issue when trying to run the command:

Fatal error: Call to undefined function: date_default_timezone_set() in /nfs/c04/h01/mnt/59856/users/.home/autosmush/autosmush on line 16

I'm running PHP 5.3.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.