Skip to content

Commit

Permalink
Merge pull request #15 from WURFL/feature/media-path
Browse files Browse the repository at this point in the history
Feature/media path
  • Loading branch information
bansi-evrig authored Nov 4, 2022
2 parents d16b836 + d41b13f commit d25f0ab
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Model/Plugins/Store/Model/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ public function afterGetBaseUrl(
'smimageoptimization/general/image_engine_url',
ScopeInterface::SCOPE_STORE
);
$baseUrl = $baseUrl . '/media/';
$mediaPath = $this->scopeConfig->getValue(
'smimageoptimization/general/media_path',
ScopeInterface::SCOPE_STORE
);
$baseUrl = $baseUrl . $mediaPath;
}

return $baseUrl;
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Follow the guide in the [official ImageEngine documentation](https://support.ima

# Change Log

### Version : V1.0.23
- Fixed hardcoded media path.
- Added new config text field for dynamic media folder.
- Added validation for address URL.


### Version : V1.0.22
- **Fixed:** Update client hint headers issue [#13](https://github.com/WURFL/magento-imageengine-extension/issues/13)
- Issue solved for `img-src`,`script` and `style` are controlled with a content security policy.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"require": {
"php": "~7.1.0|~7.2.0|~7.3.0|~7.4.0|~8.1.0"
},
"version": "1.0.22",
"version": "1.0.23",
"license": "MIT",
"type": "magento2-module",
"autoload": {
Expand Down
13 changes: 10 additions & 3 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="scientiamobile" translate="label" sortOrder="10">
<tab id="scientiamobile" translate="label" sortOrder="1000000">
<label>ImageEngine</label>
</tab>
<section id="smimageoptimization" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
Expand All @@ -21,10 +21,17 @@
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="image_engine_url" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>ImageEngine media url</label>
<comment>This url will change unsecure/base_media_url and secure/base_media_url.</comment>
<label>ImageEngine Delivery Address</label>
<comment>Enter the complete delivery address including `https://`.</comment>
<validate>required-entry validate-url</validate>
</field>
<field id="media_path" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Media Path</label>
<comment><![CDATA[The path, or folder, where media is stored in Magento.<br/>Make sure you have add Media folder name and it start & end with '/' (slash) e.g. '/media/.']]></comment>
<validate>required-entry</validate>
</field>
</group>
</section>
</system>
</config>

3 changes: 2 additions & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<image_engine_url></image_engine_url>
<unsecure_base_media_url></unsecure_base_media_url>
<secure_base_media_url></secure_base_media_url>
<media_path>/media/</media_path>
</general>
</smimageoptimization>
</default>
</config>
</config>

0 comments on commit d25f0ab

Please sign in to comment.