Skip to:

I have a solution to shrink image sizes uploaded with the Activity Plus plugin

  • Avatar of GearMX


    Hi –

    The BuddyPress Activity Plus plugin is a must have add-on for BuddyPress in my opinion. However, due to its current design, it allows uploads of any image size that stays there. That means that a user can upload a 10MB image file and it will stay on your server as a 10MB file in the ‘bpfb’ folder. You can edit the Activity Plus code to limit the upload size, but this will soon become a massive hassle for users to reduce file sizes on their own (especially if a user wants to snap a shot with their mobile phone and upload to the activity stream). Here is my current solution:

    1) Install ImageMagick on your server
    2) Set up a cron job with the following command: cd “public_html/wp-content/uploads/bpfb/” && mogrify -strip -resize 800×800\> *.jpeg *.jpg
    (This will look at the directory and resize all jpegs image to 800×800 and not increase (blow up) images that are smaller).

    Works perfect, with one drawback: This solution will keep re-compressing files that have already been resized)… So if I set cron to resize once a week, it will recompress the file 52 times a year. In my situation I don’t really mind, but to make this solution better, I am working on a PHP script to SKIP files that have already been resized and re-compressed… but this is the solution I’m using right now and it works. If someone wants to help & co-build a PHP script with me please let me know (or if someone has a better overall solution)

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.