[solved] image resizing (filesize reduction)

Post Reply
matto
Jr. Bludit
Posts: 9
Joined: Fri Feb 19, 2016 6:50 pm

To serve smaller images, filter them through a php script from https://cimage.se/

I added

Code: Select all

RewriteRule ^bl-content/uploads/(.*)$    imgd.php?src=$1 [NC,L]
to my htaccess.

how do i use it?
if this is your markup:

Code: Select all

![MYIMAGE](imageFile.jpg)
change it to soething like:

Code: Select all

![MYIMAGE](imageFile.jpg&w=600)
to get a 600px wide image.


To filter EVERY image add something like

Code: Select all

RewriteRule ^bl-content/uploads/(.*)$    imgd.php?w=1000&src=$1 [NC,L]
to your htaccess.

Now every image is scaled to a width of 1000px, but you still can overwrite this value in your markup! (see above)

have fun
matto


------



Hi!

Is there a function to resize images?
At the moment i am runnig convert over all pictures
for i in *.jpg ; do ls -sh $i; convert -quality 75 -resize 800 $i $i; ls -sh $i ;done
this works, but is destructive and not elegant.
(I literally want to reduce filesizes)

There is a private function to resize images in the image-helper (i think to generate thumbnails?), so i think there must be a better way.

greeting
matto
Last edited by matto on Thu Apr 06, 2017 11:01 am, edited 1 time in total.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Nice solution. Thank you for sharing!
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply