Jump to content

Shrink existing pics?


Recommended Posts

Posted

We have a lot of oversize pics on our server that we need to shrink down to save space.

Just wondering if anyone has seen a tool around that can be used to shrink the existing oversize pics that were uploaded prior to changing to settings so it shrinks them at the time of upload. Doing them one by one manually would be a major PITA.

Thanks in advance for any help,
Dudz

Posted

Look for comand line scripts inside the tools folder, supposing you are talking about the gallery.




Pics uploaded in forum posts are more of an issue than than the gallery, but both would be nice.
Posted

Well... one method would be...

Install imagemagick on your server. and then run...

find . -name "*.jpg" -exec convert {} -resize 50% {} ;



But, before you run, you should know what the hell you're running.

find looks for files at . directory, meaning current. See docs yourself http://unixhelp.ed.ac.uk/CGI/man-cgi?find
with -name, you select all jpg files.
-exec command executes all the stuff that follows it.
convert is the function from imagemagick.
{} is the line that's found by find.
-resize sets what size you want it to resize to. See docs for yourself http://www.imagemagick.org/Usage/resize/#resize
; denotes the end of the exec.


---------------------------------------
or
---------------------------------------

You can just download and get it mass resized via something like photoshop. It does have batch tools. Google em.

Posted

Before you run the cmd for imagemagic make sure your in the right directory as when it finishes your forum could look rather funky if it's done wrong.

Done it before :P. Not good !!!

Posted

Look for comand line scripts inside the tools folder, supposing you are talking about the gallery.




Well... one method would be...




Before you run the cmd for imagemagic make sure your in the right directory as when it finishes your forum could look rather funky if it's done wrong.



Done it before :tongue:. Not good !!!





I just want to thank you guys for your help ...and offer to the masses, my solution to the problem. I do not take full credit for this, I did have some additional help from another friend in the creation of it.

Although I did not directly use your suggestions, they did help point me in the right direction.
Here is what I ended up doing, via the cron system, and it works like a champ!

I have a .sh file, placed in the root folder, with cron executing it as shown in this pic.
post-249155-0-43164500-1344963259_thumb.


Here is the code contained in the file:

#!/bin/bash


# this script strips the exif data from already uploaded jpg photos

# using mogrify. Mogrify is part of the ImageMagick suite of tools


# 8-13-2012 added more script to resize the images, while keeping the original aspect ratio intact

# it will not look inside subfolders so you must add each folder you wish it to search through, like i have done

# it will reduce to the specified pixel size but will not affect any image which is already smaller

# you can adjust the pixel size to your liking



for i in `ls -R $HOME/public_html/uploads/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done


for i in `ls -R $HOME/public_html/uploads/monthly_01_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_02_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_03_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_04_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_05_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_06_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_07_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_08_2012/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_12_2011/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_11_2011/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_10_2011/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_09_2011/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/monthly_08_2011/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done


for i in `ls -R $HOME/public_html/uploads/bgimages/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done


for i in `ls -R $HOME/public_html/uploads/gallery/album_1/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_7/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_8/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_13/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_15/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_18/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_19/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_20/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_21/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_22/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_23/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done

for i in `ls -R $HOME/public_html/uploads/gallery/album_24/*.jpg`; do mogrify -resize 800x800> -strip $i > /dev/null ; done


exit;




Please feel free to copy/share this information in other areas of the board where appropriate.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...