Resize images at upload time

Bug #717184 reported by Steve Bailey
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
Mike Kelly

Bug Description

I'm aware that the roadmap for 1.4 mentions resizing images on the fly for use in Views, however, I feel that it would be more appropriate to resize images when they are uploaded as this would avoid using too much of a user's quota. The way I envisage this is that the site administrator sets a maximum size and any image larger than this is automatically resized. Perhaps also there could be a checkbox when uploading to override this, in the rare case that an image needs to be full-resolution.

Changed in mahara:
importance: Undecided → Wishlist
status: New → Triaged
summary: - Wishlist: resize images at upload
+ Resize images at upload time
Revision history for this message
Steve Bailey (stevobailey) wrote :

I've managed to get this developed by our local team. There is now a preselected option to resize any image to defaults set in the administration pages (we've gone for 1024 x 768), maintaining aspect ratio, which appears anywhere a file can be uploaded. The upload takes a little longer but it makes massive savings on space. I've attached a screen shot for information. Is there an easy way to contribute this back? I'm not an expert in this stuff but I can ask our developers to help out where necessary.

Revision history for this message
François Marier (fmarier) wrote :

Hi Steve,

The process for contributing code directly to our code-review system is described here:

  https://wiki.mahara.org/index.php/Developer_Area/Contributing_Code

It's quite a few things to work through if you haven't done it before so if you don't have much time to do this, then you can also create a patch and attaching it here. Whoever picks up this bug will be able to see what you've done and perhaps base their solution on it.

Cheers,
Francois

tags: added: fileupload
Revision history for this message
Steve Bailey (stevobailey) wrote :

I've attached a patch file which should work. I should add the caveat that I've never done a patch before so I can't guarantee it. However, I've also attached a Zip file (provided by our developers) which will perform the same task if you overwrite the artefact/file folder with its contents.

Revision history for this message
Steve Bailey (stevobailey) wrote :

...and the Zip.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hello Steve,

Thank you for the patch. Were you thinking of using our review system instead (as Francois described above) so that your code could be committed straight through there. In addition, you would also get credit for it in git.

Cheers
Kristina

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

P.S. We can help you get started with using git. I am more of a novice myself, but one of the experienced developers can lend you a hand.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :
Changed in mahara:
status: Triaged → Fix Committed
milestone: none → 1.6.0
assignee: nobody → Mike Kelly (m-f-kelly)
Revision history for this message
Alan McNatty (alanmc) wrote :

Just a comment on the implementation.

It is a shame this was implemented in the view (function pieform_element_filebrowser_upload) and not in the base file artefact class (i.e. ArtefactTypeFile::save_uploaded_file method).

If a user has enabled image resizing then ArtefactTypeFile::save_uploaded_file should resize the image on save automatically. What has been implemented is a Fix to the web-form only - the biggest culprit to uploading oversized images may be mobile devices (as the mobile user often lacks the control to resize the content on the device)

With this implementation the mobile API would need to reinvent the wheel. The endable resize config option does not actual resize all uploaded content.

Revision history for this message
Alan McNatty (alanmc) wrote :

I will create a secondary bug to move the functionality

Melissa Draper (melissa)
tags: added: newfeature1.6
Revision history for this message
Hugh Davenport (hugh-davenport) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 status fixreleased
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iJwEAQECAAYFAlCbHO8ACgkQuMoJ2LQ3zxH8TAP/YN4BiCJZsn5a899/0UzV31Qg
lM8LXAwZWa6zFv6t0BQUHCqe6eFK9wPp51qgCWWXjUZ3vvvVcsyeWp6626aBFKSU
pCQXI9E7huPw802nJQ9WcZXRBUmgw87ww72Tx4mybnu7SPSrkZgXdnPGSMwDs89N
oWvTpl7Xuac48e6p0lU=
=ouU+
-----END PGP SIGNATURE-----

Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.