Skip to content

Instantly share code, notes, and snippets.

@stephenmckinney
Created March 22, 2012 17:31
Show Gist options
  • Save stephenmckinney/2160434 to your computer and use it in GitHub Desktop.
Save stephenmckinney/2160434 to your computer and use it in GitHub Desktop.
Getting smush.py up on Ubuntu and compiling and patching pngnq
# install libs
sudo apt-get install gifsicle
sudo apt-get install imagemagick
sudo apt-get install pngcrush
sudo apt-get install libjpeg-progs
sudo apt-get install pkg-config
sudo apt-get install libpng-dev
# get smush.py
cd /var/apps/macarthur_cms_env/bin/
git clone https://github.com/beatak/smush.py.git
# compile pngnq
cd ~
wget http://sourceforge.net/projects/pngnq/files/latest/download
tar -xzvf download
cd pngnq-1.1/src
patch < /var/apps/macarthur_cms_env/bin/smush.py/contrib/pngnq-1.1.patch
cd ..
./configure
make
sudo make install
cd ..
rm -rf ~/pngnq-1.1
# tar and zip files
cd /var/www/macarthur_cms/
tar cvzf media_backup.tar.gz media/
# check storage size
du -k /var/www/macarthur_cms/media
1344 media/files
2108 media/staff_photos
20 media/program_icons
30292 media/promo_key_images
36 media/homepage_billboard_images
1384 media/fellows/profile_photos
584 media/fellows/billboard_photos
448 media/fellows/background_photos
27968 media/fellows/slideshow_photos
30388 media/fellows
1444 media/program_images
6196 media/youtube_video_keyframes
807580 media/photos
348 media/feature_images
104 media/country_office_images
16 media/staff_cvs
204204 media/article_pdfs
1084084 media
# run
cd /var/apps/macarthur_cms_env/
source bin/activate
sudo python /var/apps/macarthur_cms_env/bin/smush.py/smush.py -r -s /var/www/macarthur_cms/media/country_office_images /var/www/macarthur_cms/media/feature_images /var/www/macarthur_cms/media/fellows /var/www/macarthur_cms/media/homepage_billboard_images /var/www/macarthur_cms/media/photos /var/www/macarthur_cms/media/program_icons /var/www/macarthur_cms/media/program_images /var/www/macarthur_cms/media/promo_key_images /var/www/macarthur_cms/media/staff_photos /var/www/macarthur_cms/media/youtube_video_keyframes
# check again
du -k /var/www/macarthur_cms/media
1344 /var/www/macarthur_cms/media/files
2080 /var/www/macarthur_cms/media/staff_photos
20 /var/www/macarthur_cms/media/program_icons
28252 /var/www/macarthur_cms/media/promo_key_images
36 /var/www/macarthur_cms/media/homepage_billboard_images
1376 /var/www/macarthur_cms/media/fellows/profile_photos
572 /var/www/macarthur_cms/media/fellows/billboard_photos
364 /var/www/macarthur_cms/media/fellows/background_photos
21344 /var/www/macarthur_cms/media/fellows/slideshow_photos
23660 /var/www/macarthur_cms/media/fellows
1280 /var/www/macarthur_cms/media/program_images
5740 /var/www/macarthur_cms/media/youtube_video_keyframes
727480 /var/www/macarthur_cms/media/photos
204 /var/www/macarthur_cms/media/feature_images
96 /var/www/macarthur_cms/media/country_office_images
16 /var/www/macarthur_cms/media/staff_cvs
204204 /var/www/macarthur_cms/media/article_pdfs
994416 /var/www/macarthur_cms/media
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment