Skip to content

Commit

Permalink
Issue Vinai#22: Add option to hash the image folder name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinai committed Nov 14, 2014
1 parent b55502e commit c8e14b0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ protected function _getNiceFileName($file)
{
// add the image name without the file type extension to the image cache path
list($pathExt, $extension) = $this->_getFileNameParts($file);

if (Mage::getStoreConfig("catalog/nicerimagenames/hash_image_folder_name")) {
$pathExt = md5($pathExt);
}

$file = $this->getNiceCacheName();
return sprintf('/%s/%s.%s', $pathExt, $file, $extension);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<config>
<modules>
<Netzarbeiter_NicerImageNames>
<version>0.2.5</version>
<version>0.2.6</version>
</Netzarbeiter_NicerImageNames>
</modules>

Expand Down Expand Up @@ -93,6 +93,7 @@
<map>%requestHost-%manufacturer-%sku</map>
<unique>1</unique>
<lowercase>0</lowercase>
<hash_image_folder_name>0</hash_image_folder_name>
<generate_labels>0</generate_labels>
<use_filename_map_for_labels>1</use_filename_map_for_labels>
<label_map>%name %sku</label_map>
Expand Down
13 changes: 13 additions & 0 deletions app/code/community/Netzarbeiter/NicerImageNames/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@
<disable_ext>0</disable_ext>
</depends>
</lowercase>
<hash_image_folder_name translate="label comment" module="nicerimagenames">
<label>Hash the image name folder</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>45</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>The original file name is used as a folder to contain the renamed image. If you don't want that to be part of the image URL, switch this option to Yes.</comment>
<depends>
<disable_ext>0</disable_ext>
</depends>
</hash_image_folder_name>
<generate_labels translate="label comment" module="nicerimagenames">
<label>Generate ALT Attributes if Emtpy</label>
<frontend_type>select</frontend_type>
Expand Down
3 changes: 2 additions & 1 deletion app/locale/de_DE/Netzarbeiter_NicerImageNames.csv
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
"Select ""No"" to configure.","Wähle ""Nein"" für weitere Konfiguration."
"Use the same Map for ALT as for the File Names","Benutze die gleiche Vorlage wie für Bildnamen"
"ALT Name Map","ALT Text Vorlage"

"The original file name is used as a folder to contain the renamed image. If you don't want that to be part of the image URL, switch this option to Yes.","Der ursprüngliche Dateiname wird als Verzeichnis für das umbenannte Bild genutzt. Wenn er nicht Teil der Bild-URL sein soll, aktivieren Sie diese option."
"Hash the image name folder","Bild-Verzeichnis hashen"
5 changes: 2 additions & 3 deletions app/locale/en_US/Netzarbeiter_NicerImageNames.csv
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"Select ""No"" to configure.","Select ""No"" to configure."
"Use the same Map for ALT as for the File Names","Use the same Map for ALT as for the File Names"
"ALT Name Map","ALT Name Map"



"The original file name is used as a folder to contain the renamed image. If you don't want that to be part of the image URL, switch this option to Yes.","The original file name is used as a folder to contain the renamed image. If you don't want that to be part of the image URL, switch this option to Yes."
"Hash the image name folder","Hash the image name folder"

0 comments on commit c8e14b0

Please sign in to comment.