Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.6k views
in Q2A Core by

Is there any way I can resize uploaded images to a smaller size?

E.g. somebody uploads an image of 1800 x 1800, and I would like to reduce the size to 800x800 max.

Would be saving big amounts of database storage. Esp. if there is no encoding of the images → can we convert them actually for better encoding?

Here is an example of a PNG of my users (it has 418 KB°!)

skizze2.png

Using the image editor XNView and saving it again I have a PNG of only 16 KB°!

skizze2_opt

 

by
Update: The first image just has the ending PNG, it was a BMP. That's why it is so big. Continue reading here: http://www.question2answer.org/qa/18727/why-does-q2a-outputs-bmp-image-instead-of-png-image-bug

2 Answers

+2 votes
by

You can use something like PHP imagecopyresized()  and then substitute the new image. If you Google that, you will find some sample code and even some functions where all you need are the input file.

You could even make a script that does this to your existing blobs. Q2A blob images can be output with an url like: http://talksec.com//?qa=blob&qa_blobid=8746650502015071737 so you can get this image, resize it, and rewrite it back to the db.

I would recommend doing this instead of trying to incorporate resizing into the editor. 

 

by
Hi Merkus, thanks for letting me know. I think I have to do both: a script/plugin that resizes the current images from the db, and a hack of qa-wysiwyg-upload.php to resize when uploaded by user. Thanks.
by
0 votes
by

HI there

To resize uploaded images to a smaller size is difficult if you don't have an image program.

I believe there must be an powerful image program which supports to do that.

You can just add one.Best wishes.

...