Image compression module allows you to upload images onto your site and allow them to be compressed based upon certain ranges.
For example you can state that any image larger than 2MB is compressed by a rate of X and anything over 3MB is compressed by rate of Y.
There are also options to compress the image before upload size validation, this allows the image upload limit to be say 2MB then when you upload an image larger than that compression is done prior to validation allowing for the possibility of uploading larger images.

Project link

https://www.drupal.org/project/image_compression

Git instructions

git clone --branch '2.0.x' https://git.drupalcode.org/project/image_compression.git

Comments

3li created an issue. See original summary.

3li’s picture

Issue summary: View changes
geoanders’s picture

Ran a quick standards scan. See the results below:

FILE: /image_compression/src/Form/CompressExistingImagesForm.php
------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------
 26 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 82 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------


FILE: /image_compression/src/Form/ImageCompressionSettingsForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 41 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 82 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 83 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /image_compression/src/ImageCompressionServices.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
  24 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  61 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 126 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------
geoanders’s picture

And a few more:

FILE: /image_compression/src/ImageCompressionServices.php
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 24 | ERROR | [x] Each PHP statement must be on a line by itself
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: /image_compression/src/ImageCompressionHelperService.php
----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------
 165 | ERROR | [x] Each PHP statement must be on a line by itself
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------


FILE: /image_compression/image_compression.install
----------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
 1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
 3 | ERROR | [x] Doc comment short description must be on the first line
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------


FILE: /image_compression/image_compression.routing.yml
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 19 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------


FILE: /image_compression/image_compression.services.yml
---------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 5 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------


FILE: /image_compression/image_compression.links.menu.yml
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 5 | ERROR | [x] Expected 1 newline at end of file; 2 found
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: /image_compression/image_compression.links.task.yml
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 10 | ERROR | [x] Expected 1 newline at end of file; 3 found
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------


FILE: /image_compression/image_compression.module
---------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------
 20 | ERROR | [x] Expected 1 blank line after function; 2 found
---------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------
avpaderno’s picture

Status: Needs review » Needs work
3li’s picture

Status: Needs work » Needs review

Thanks for the feedback,
I have resolved the above Drupal standards and best practices.

geoanders’s picture

Code standards issues seem to be fixed now. Thanks!

3li’s picture

Is there anything else I can do to help the this review?

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Fixed

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.