Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WS2-1575: Card Arrangement: PNG images not being compressed #76

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/install/file_mdm.file_metadata_plugin.getimagesize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
configuration:
cache:
override: false
settings:
enabled: true
expiration: 172800
disallowed_paths: { }
4 changes: 4 additions & 0 deletions config/install/file_mdm.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
metadata_cache:
enabled: true
expiration: 172800
disallowed_paths: { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
configuration:
cache:
override: false
settings:
enabled: true
expiration: 172800
disallowed_paths: { }
59 changes: 59 additions & 0 deletions config/install/imagemagick.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
quality: 75
binaries: imagemagick
path_to_binaries: ''
prepend: ''
log_warnings: true
debug: false
locale: en_US.UTF-8
image_formats:
PNG:
mime_type: image/png
JPEG:
mime_type: image/jpeg
JPG:
mime_type: image/jpeg
weight: 10
enabled: false
GIF:
mime_type: image/gif
GIF87:
mime_type: image/gif
weight: 10
enabled: false
SVG:
mime_type: image/svg+xml
enabled: false
WEBP:
mime_type: image/webp
AVIF:
mime_type: image/avif
enabled: false
TIFF:
mime_type: image/tiff
enabled: false
PDF:
mime_type: application/pdf
enabled: false
HEIC:
mime_type: image/heif
enabled: false
BMP:
mime_type: image/x-ms-bmp
enabled: false
PSD:
mime_type: image/x-photoshop
enabled: false
WBMP:
mime_type: image/vnd.wap.wbmp
enabled: false
XBM:
mime_type: image/x-xbitmap
enabled: false
ICO:
mime_type: image/vnd.microsoft.icon
enabled: false
advanced:
density: 0
colorspace: '0'
profile: ''
coalesce: false
3 changes: 3 additions & 0 deletions config/install/sophron.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
map_option: 0
map_class: ''
map_commands: { }
1 change: 1 addition & 0 deletions config/install/system.image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
toolkit: imagemagick
3 changes: 3 additions & 0 deletions webspark.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ install:
- webspark_webdir
- maxlength
- field_states_ui
- file_mdm
- sophron
- imagemagick
themes:
- bartik
- seven
Expand Down
21 changes: 21 additions & 0 deletions webspark.install
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,24 @@ function webspark_update_9012(&$sandbox) {
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}

/**
* Install imagemagick module and dependencies.
*/
function webspark_update_9013(&$sandbox) {
$module_installer = \Drupal::service("module_installer");

$module_installer->install(["file_mdm"]);
$module_installer->install(["sophron"]);
$module_installer->install(["imagemagick"]);

// Importing configs for ImageMagick module.
\Drupal::state()->set('configuration_locked', FALSE);
\Drupal::service('webspark.config_manager')->importConfigFile('file_mdm.file_metadata_plugin.getimagesize.yml');
\Drupal::service('webspark.config_manager')->importConfigFile('file_mdm.settings.yml');
\Drupal::service('webspark.config_manager')->importConfigFile('imagemagick.file_metadata_plugin.imagemagick_identify.yml');
\Drupal::service('webspark.config_manager')->importConfigFile('imagemagick.settings.yml');
\Drupal::service('webspark.config_manager')->importConfigFile('sophron.settings.yml');
\Drupal::service('webspark.config_manager')->importConfigFile('system.image.yml');
\Drupal::state()->set('configuration_locked', TRUE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juanmitriatti The importConfigFile function requires that the file name not have the extension at the end. Also, there is a problem with that function. It should reference $filename, but it only references the undefined $name variable. So, it doesn't work. I have created a ticket that fixes that problem and issued a pull request. So, now this PR depends on that one (ASUWebPlatforms/webspark-module-webspark_utility#23).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tbutterf
Pr has been updated, please check.
Thanks for your feedback.

}