Skip to content

Instantly share code, notes, and snippets.

@hkulekci
Last active January 25, 2023 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkulekci/4503178 to your computer and use it in GitHub Desktop.
Save hkulekci/4503178 to your computer and use it in GitHub Desktop.
added image resize type to image part of setting/setting. added product option image size config to image part of setting/setting. added the same options to settings/store. For opencart
commit b72d71d36f0e851b82d0486f19013ffda5b48a5d
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Sun Jan 6 04:20:15 2013 +0200
added image resize type to image part of setting/setting.
added product option image size config to image part of setting/setting.
i will add the same options to settings/store.
diff --git a/upload/admin/controller/setting/setting.php b/upload/admin/controller/setting/setting.php
index dbfc32c..d58a2a7 100644
--- a/upload/admin/controller/setting/setting.php
+++ b/upload/admin/controller/setting/setting.php
@@ -45,6 +45,10 @@ class ControllerSettingSetting extends Controller {
$this->data['text_payment'] = $this->language->get('text_payment');
$this->data['text_mail'] = $this->language->get('text_mail');
$this->data['text_smtp'] = $this->language->get('text_smtp');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_owner'] = $this->language->get('entry_owner');
@@ -103,6 +107,7 @@ class ControllerSettingSetting extends Controller {
$this->data['entry_image_product'] = $this->language->get('entry_image_product');
$this->data['entry_image_additional'] = $this->language->get('entry_image_additional');
$this->data['entry_image_related'] = $this->language->get('entry_image_related');
+ $this->data['entry_image_option'] = $this->language->get('entry_image_option');
$this->data['entry_image_compare'] = $this->language->get('entry_image_compare');
$this->data['entry_image_wishlist'] = $this->language->get('entry_image_wishlist');
$this->data['entry_image_cart'] = $this->language->get('entry_image_cart');
@@ -274,6 +279,12 @@ class ControllerSettingSetting extends Controller {
$this->data['error_image_related'] = '';
}
+ if (isset($this->error['image_option'])) {
+ $this->data['error_image_option'] = $this->error['image_option'];
+ } else {
+ $this->data['error_image_option'] = '';
+ }
+
if (isset($this->error['image_compare'])) {
$this->data['error_image_compare'] = $this->error['image_compare'];
} else {
@@ -737,6 +748,12 @@ class ControllerSettingSetting extends Controller {
} else {
$this->data['config_image_category_height'] = $this->config->get('config_image_category_height');
}
+
+ if (isset($this->request->post['config_image_category_resize_type'])) {
+ $this->data['config_image_category_resize_type'] = $this->request->post['config_image_category_resize_type'];
+ } else {
+ $this->data['config_image_category_resize_type'] = $this->config->get('config_image_category_resize_type');
+ }
if (isset($this->request->post['config_image_thumb_width'])) {
$this->data['config_image_thumb_width'] = $this->request->post['config_image_thumb_width'];
@@ -750,6 +767,12 @@ class ControllerSettingSetting extends Controller {
$this->data['config_image_thumb_height'] = $this->config->get('config_image_thumb_height');
}
+ if (isset($this->request->post['config_image_thumb_resize_type'])) {
+ $this->data['config_image_thumb_resize_type'] = $this->request->post['config_image_thumb_resize_type'];
+ } else {
+ $this->data['config_image_thumb_resize_type'] = $this->config->get('config_image_thumb_resize_type');
+ }
+
if (isset($this->request->post['config_image_popup_width'])) {
$this->data['config_image_popup_width'] = $this->request->post['config_image_popup_width'];
} else {
@@ -762,6 +785,12 @@ class ControllerSettingSetting extends Controller {
$this->data['config_image_popup_height'] = $this->config->get('config_image_popup_height');
}
+ if (isset($this->request->post['config_image_popup_resize_type'])) {
+ $this->data['config_image_popup_resize_type'] = $this->request->post['config_image_popup_resize_type'];
+ } else {
+ $this->data['config_image_popup_resize_type'] = $this->config->get('config_image_popup_resize_type');
+ }
+
if (isset($this->request->post['config_image_product_width'])) {
$this->data['config_image_product_width'] = $this->request->post['config_image_product_width'];
} else {
@@ -773,6 +802,12 @@ class ControllerSettingSetting extends Controller {
} else {
$this->data['config_image_product_height'] = $this->config->get('config_image_product_height');
}
+
+ if (isset($this->request->post['config_image_product_resize_type'])) {
+ $this->data['config_image_product_resize_type'] = $this->request->post['config_image_product_resize_type'];
+ } else {
+ $this->data['config_image_product_resize_type'] = $this->config->get('config_image_product_resize_type');
+ }
if (isset($this->request->post['config_image_additional_width'])) {
$this->data['config_image_additional_width'] = $this->request->post['config_image_additional_width'];
@@ -786,6 +821,12 @@ class ControllerSettingSetting extends Controller {
$this->data['config_image_additional_height'] = $this->config->get('config_image_additional_height');
}
+ if (isset($this->request->post['config_image_additional_resize_type'])) {
+ $this->data['config_image_additional_resize_type'] = $this->request->post['config_image_additional_resize_type'];
+ } else {
+ $this->data['config_image_additional_resize_type'] = $this->config->get('config_image_additional_resize_type');
+ }
+
if (isset($this->request->post['config_image_related_width'])) {
$this->data['config_image_related_width'] = $this->request->post['config_image_related_width'];
} else {
@@ -798,6 +839,30 @@ class ControllerSettingSetting extends Controller {
$this->data['config_image_related_height'] = $this->config->get('config_image_related_height');
}
+ if (isset($this->request->post['config_image_related_resize_type'])) {
+ $this->data['config_image_related_resize_type'] = $this->request->post['config_image_related_resize_type'];
+ } else {
+ $this->data['config_image_related_resize_type'] = $this->config->get('config_image_related_resize_type');
+ }
+
+ if (isset($this->request->post['config_image_option_width'])) {
+ $this->data['config_image_option_width'] = $this->request->post['config_image_option_width'];
+ } else {
+ $this->data['config_image_option_width'] = $this->config->get('config_image_option_width');
+ }
+
+ if (isset($this->request->post['config_image_option_height'])) {
+ $this->data['config_image_option_height'] = $this->request->post['config_image_option_height'];
+ } else {
+ $this->data['config_image_option_height'] = $this->config->get('config_image_option_height');
+ }
+
+ if (isset($this->request->post['config_image_option_resize_type'])) {
+ $this->data['config_image_option_resize_type'] = $this->request->post['config_image_option_resize_type'];
+ } else {
+ $this->data['config_image_option_resize_type'] = $this->config->get('config_image_option_resize_type');
+ }
+
if (isset($this->request->post['config_image_compare_width'])) {
$this->data['config_image_compare_width'] = $this->request->post['config_image_compare_width'];
} else {
@@ -810,6 +875,12 @@ class ControllerSettingSetting extends Controller {
$this->data['config_image_compare_height'] = $this->config->get('config_image_compare_height');
}
+ if (isset($this->request->post['config_image_compare_resize_type'])) {
+ $this->data['config_image_compare_resize_type'] = $this->request->post['config_image_compare_resize_type'];
+ } else {
+ $this->data['config_image_compare_resize_type'] = $this->config->get('config_image_compare_resize_type');
+ }
+
if (isset($this->request->post['config_image_wishlist_width'])) {
$this->data['config_image_wishlist_width'] = $this->request->post['config_image_wishlist_width'];
} else {
@@ -821,6 +892,12 @@ class ControllerSettingSetting extends Controller {
} else {
$this->data['config_image_wishlist_height'] = $this->config->get('config_image_wishlist_height');
}
+
+ if (isset($this->request->post['config_image_wishlist_resize_type'])) {
+ $this->data['config_image_wishlist_resize_type'] = $this->request->post['config_image_wishlist_resize_type'];
+ } else {
+ $this->data['config_image_wishlist_resize_type'] = $this->config->get('config_image_wishlist_resize_type');
+ }
if (isset($this->request->post['config_image_cart_width'])) {
$this->data['config_image_cart_width'] = $this->request->post['config_image_cart_width'];
@@ -832,6 +909,12 @@ class ControllerSettingSetting extends Controller {
$this->data['config_image_cart_height'] = $this->request->post['config_image_cart_height'];
} else {
$this->data['config_image_cart_height'] = $this->config->get('config_image_cart_height');
+ }
+
+ if (isset($this->request->post['config_image_cart_resize_type'])) {
+ $this->data['config_image_cart_resize_type'] = $this->request->post['config_image_cart_resize_type'];
+ } else {
+ $this->data['config_image_cart_resize_type'] = $this->config->get('config_image_cart_resize_type');
}
if (isset($this->request->post['config_ftp_host'])) {
@@ -1120,6 +1203,10 @@ class ControllerSettingSetting extends Controller {
$this->error['image_related'] = $this->language->get('error_image_related');
}
+ if (!$this->request->post['config_image_related_width'] || !$this->request->post['config_image_option_height']) {
+ $this->error['image_option'] = $this->language->get('error_image_option');
+ }
+
if (!$this->request->post['config_image_compare_width'] || !$this->request->post['config_image_compare_height']) {
$this->error['image_compare'] = $this->language->get('error_image_compare');
}
diff --git a/upload/admin/language/english/setting/setting.php b/upload/admin/language/english/setting/setting.php
index 569264f..4ea0064 100644
--- a/upload/admin/language/english/setting/setting.php
+++ b/upload/admin/language/english/setting/setting.php
@@ -79,6 +79,7 @@ $_['entry_image_popup'] = 'Product Image Popup Size:';
$_['entry_image_product'] = 'Product Image List Size:';
$_['entry_image_additional'] = 'Additional Product Image Size:';
$_['entry_image_related'] = 'Related Product Image Size:';
+$_['entry_image_option'] = 'Product Option Image Size:';
$_['entry_image_compare'] = 'Compare Image Size:';
$_['entry_image_wishlist'] = 'Wish List Image Size:';
$_['entry_image_cart'] = 'Cart Image Size:';
@@ -136,6 +137,7 @@ $_['error_image_product'] = 'Product List Size dimensions required!';
$_['error_image_category'] = 'Category List Size dimensions required!';
$_['error_image_additional'] = 'Additional Product Image Size dimensions required!';
$_['error_image_related'] = 'Related Product Image Size dimensions required!';
+$_['error_image_option'] = 'Product Option Image Size dimensions required!';
$_['error_image_compare'] = 'Compare Image Size dimensions required!';
$_['error_image_wishlist'] = 'Wish List Image Size dimensions required!';
$_['error_image_cart'] = 'Cart Image Size dimensions required!';
diff --git a/upload/admin/view/template/setting/setting.tpl b/upload/admin/view/template/setting/setting.tpl
index 112341a..fd82c22 100644
--- a/upload/admin/view/template/setting/setting.tpl
+++ b/upload/admin/view/template/setting/setting.tpl
@@ -623,6 +623,11 @@
<td><input type="text" name="config_image_category_width" value="<?php echo $config_image_category_width; ?>" size="3" />
x
<input type="text" name="config_image_category_height" value="<?php echo $config_image_category_height; ?>" size="3" />
+ <select name="config_image_category_resize_type">
+ <option value="default"<?php echo ( ($config_image_category_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_category_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_category_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_category) { ?>
<span class="error"><?php echo $error_image_category; ?></span>
<?php } ?></td>
@@ -632,6 +637,11 @@
<td><input type="text" name="config_image_thumb_width" value="<?php echo $config_image_thumb_width; ?>" size="3" />
x
<input type="text" name="config_image_thumb_height" value="<?php echo $config_image_thumb_height; ?>" size="3" />
+ <select name="config_image_thumb_resize_type">
+ <option value="default"<?php echo ( ($config_image_thumb_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_thumb_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_thumb_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_thumb) { ?>
<span class="error"><?php echo $error_image_thumb; ?></span>
<?php } ?></td>
@@ -641,6 +651,11 @@
<td><input type="text" name="config_image_popup_width" value="<?php echo $config_image_popup_width; ?>" size="3" />
x
<input type="text" name="config_image_popup_height" value="<?php echo $config_image_popup_height; ?>" size="3" />
+ <select name="config_image_popup_resize_type">
+ <option value="default"<?php echo ( ($config_image_popup_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_popup_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_popup_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_popup) { ?>
<span class="error"><?php echo $error_image_popup; ?></span>
<?php } ?></td>
@@ -650,6 +665,11 @@
<td><input type="text" name="config_image_product_width" value="<?php echo $config_image_product_width; ?>" size="3" />
x
<input type="text" name="config_image_product_height" value="<?php echo $config_image_product_height; ?>" size="3" />
+ <select name="config_image_product_resize_type">
+ <option value="default"<?php echo ( ($config_image_product_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_product_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_product_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_product) { ?>
<span class="error"><?php echo $error_image_product; ?></span>
<?php } ?></td>
@@ -659,6 +679,11 @@
<td><input type="text" name="config_image_additional_width" value="<?php echo $config_image_additional_width; ?>" size="3" />
x
<input type="text" name="config_image_additional_height" value="<?php echo $config_image_additional_height; ?>" size="3" />
+ <select name="config_image_additional_resize_type">
+ <option value="default"<?php echo ( ($config_image_additional_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_additional_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_additional_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_additional) { ?>
<span class="error"><?php echo $error_image_additional; ?></span>
<?php } ?></td>
@@ -668,15 +693,39 @@
<td><input type="text" name="config_image_related_width" value="<?php echo $config_image_related_width; ?>" size="3" />
x
<input type="text" name="config_image_related_height" value="<?php echo $config_image_related_height; ?>" size="3" />
+ <select name="config_image_related_resize_type">
+ <option value="default"<?php echo ( ($config_image_related_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_related_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_related_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_related) { ?>
<span class="error"><?php echo $error_image_related; ?></span>
<?php } ?></td>
</tr>
<tr>
+ <td><span class="required">*</span> <?php echo $entry_image_option; ?></td>
+ <td><input type="text" name="config_image_option_width" value="<?php echo $config_image_option_width; ?>" size="3" />
+ x
+ <input type="text" name="config_image_option_height" value="<?php echo $config_image_option_height; ?>" size="3" />
+ <select name="config_image_option_resize_type">
+ <option value="default"<?php echo ( ($config_image_option_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_option_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_option_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
+ <?php if ($error_image_option) { ?>
+ <span class="error"><?php echo $error_image_option; ?></span>
+ <?php } ?></td>
+ </tr>
+ <tr>
<td><span class="required">*</span> <?php echo $entry_image_compare; ?></td>
<td><input type="text" name="config_image_compare_width" value="<?php echo $config_image_compare_width; ?>" size="3" />
x
<input type="text" name="config_image_compare_height" value="<?php echo $config_image_compare_height; ?>" size="3" />
+ <select name="config_image_compare_resize_type">
+ <option value="default"<?php echo ( ($config_image_compare_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_compare_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_compare_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_compare) { ?>
<span class="error"><?php echo $error_image_compare; ?></span>
<?php } ?></td>
@@ -686,6 +735,11 @@
<td><input type="text" name="config_image_wishlist_width" value="<?php echo $config_image_wishlist_width; ?>" size="3" />
x
<input type="text" name="config_image_wishlist_height" value="<?php echo $config_image_wishlist_height; ?>" size="3" />
+ <select name="config_image_wishlist_resize_type">
+ <option value="default"<?php echo ( ($config_image_wishlist_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_wishlist_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_wishlist_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_wishlist) { ?>
<span class="error"><?php echo $error_image_wishlist; ?></span>
<?php } ?></td>
@@ -695,6 +749,11 @@
<td><input type="text" name="config_image_cart_width" value="<?php echo $config_image_cart_width; ?>" size="3" />
x
<input type="text" name="config_image_cart_height" value="<?php echo $config_image_cart_height; ?>" size="3" />
+ <select name="config_image_cart_resize_type">
+ <option value="default"<?php echo ( ($config_image_cart_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_cart_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_cart_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_cart) { ?>
<span class="error"><?php echo $error_image_cart; ?></span>
<?php } ?></td>
diff --git a/upload/catalog/controller/account/wishlist.php b/upload/catalog/controller/account/wishlist.php
index 4d6f299..f9c4e4b 100644
--- a/upload/catalog/controller/account/wishlist.php
+++ b/upload/catalog/controller/account/wishlist.php
@@ -81,7 +81,7 @@ class ControllerAccountWishList extends Controller {
if ($product_info) {
if ($product_info['image']) {
- $image = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_wishlist_width'), $this->config->get('config_image_wishlist_height'));
+ $image = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_wishlist_width'), $this->config->get('config_image_wishlist_height'), $this->config->get('config_image_wishlist_resize_type'));
} else {
$image = false;
}
diff --git a/upload/catalog/controller/checkout/cart.php b/upload/catalog/controller/checkout/cart.php
index e1d0330..e6f3aaa 100644
--- a/upload/catalog/controller/checkout/cart.php
+++ b/upload/catalog/controller/checkout/cart.php
@@ -195,7 +195,7 @@ class ControllerCheckoutCart extends Controller {
}
if ($product['image']) {
- $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
+ $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'), $this->config->get('config_image_cart_resize_type'));
} else {
$image = '';
}
diff --git a/upload/catalog/controller/module/cart.php b/upload/catalog/controller/module/cart.php
index caf628f..b612406 100644
--- a/upload/catalog/controller/module/cart.php
+++ b/upload/catalog/controller/module/cart.php
@@ -62,7 +62,7 @@ class ControllerModuleCart extends Controller {
foreach ($this->cart->getProducts() as $product) {
if ($product['image']) {
- $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
+ $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'), $this->config->get('config_image_cart_resize_type'));
} else {
$image = '';
}
diff --git a/upload/catalog/controller/product/category.php b/upload/catalog/controller/product/category.php
index bf27588..8e2e1cf 100644
--- a/upload/catalog/controller/product/category.php
+++ b/upload/catalog/controller/product/category.php
@@ -145,7 +145,7 @@ class ControllerProductCategory extends Controller {
);
if ($category_info['image']) {
- $this->data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
+ $this->data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'), $this->config->get('config_image_category_resize_type'));
} else {
$this->data['thumb'] = '';
}
@@ -206,7 +206,7 @@ class ControllerProductCategory extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
+ $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), $this->config->get('config_image_product_resize_type'));
} else {
$image = false;
}
diff --git a/upload/catalog/controller/product/compare.php b/upload/catalog/controller/product/compare.php
index e7af1bd..2c2f370 100644
--- a/upload/catalog/controller/product/compare.php
+++ b/upload/catalog/controller/product/compare.php
@@ -77,7 +77,7 @@ class ControllerProductCompare extends Controller {
if ($product_info) {
if ($product_info['image']) {
- $image = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_compare_width'), $this->config->get('config_image_compare_height'));
+ $image = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_compare_width'), $this->config->get('config_image_compare_height'), $this->config->get('config_image_compare_resize_type'));
} else {
$image = false;
}
diff --git a/upload/catalog/controller/product/manufacturer.php b/upload/catalog/controller/product/manufacturer.php
index f732cc2..ac02f46 100644
--- a/upload/catalog/controller/product/manufacturer.php
+++ b/upload/catalog/controller/product/manufacturer.php
@@ -193,7 +193,7 @@ class ControllerProductManufacturer extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
+ $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), $this->config->get('config_image_product_resize_type'));
} else {
$image = false;
}
diff --git a/upload/catalog/controller/product/product.php b/upload/catalog/controller/product/product.php
index a18f7de..972b281 100644
--- a/upload/catalog/controller/product/product.php
+++ b/upload/catalog/controller/product/product.php
@@ -289,13 +289,13 @@ class ControllerProductProduct extends Controller {
$this->load->model('tool/image');
if ($product_info['image']) {
- $this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
+ $this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'), $this->config->get('config_image_popup_resize_type'));
} else {
$this->data['popup'] = '';
}
if ($product_info['image']) {
- $this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
+ $this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'), $this->config->get('config_image_thumb_resize_type'));
} else {
$this->data['thumb'] = '';
}
@@ -306,8 +306,8 @@ class ControllerProductProduct extends Controller {
foreach ($results as $result) {
$this->data['images'][] = array(
- 'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')),
- 'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'))
+ 'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'), $this->config->get('config_image_popup_resize_type')),
+ 'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'), $this->config->get('config_image_additional_resize_type'))
);
}
@@ -358,7 +358,7 @@ class ControllerProductProduct extends Controller {
'product_option_value_id' => $option_value['product_option_value_id'],
'option_value_id' => $option_value['option_value_id'],
'name' => $option_value['name'],
- 'image' => $this->model_tool_image->resize($option_value['image'], 50, 50),
+ 'image' => $this->model_tool_image->resize($option_value['image'], $this->config->get('config_image_option_width'), $this->config->get('config_image_option_height'), $this->config->get('config_image_option_resize_type')),
'price' => $price,
'price_prefix' => $option_value['price_prefix']
);
@@ -403,7 +403,7 @@ class ControllerProductProduct extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'));
+ $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'), $this->config->get('config_image_related_resize_type'));
} else {
$image = false;
}
diff --git a/upload/catalog/controller/product/search.php b/upload/catalog/controller/product/search.php
index 13a7d0a..d652f51 100644
--- a/upload/catalog/controller/product/search.php
+++ b/upload/catalog/controller/product/search.php
@@ -219,7 +219,7 @@ class ControllerProductSearch extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
+ $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), $this->config->get('config_image_product_resize_type'));
} else {
$image = false;
}
diff --git a/upload/catalog/controller/product/special.php b/upload/catalog/controller/product/special.php
index 22ba5a1..b2ad788 100644
--- a/upload/catalog/controller/product/special.php
+++ b/upload/catalog/controller/product/special.php
@@ -103,7 +103,7 @@ class ControllerProductSpecial extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
+ $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'), $this->config->get('config_image_product_resize_type'));
} else {
$image = false;
}
diff --git a/upload/install/opencart.sql b/upload/install/opencart.sql
index c297457..05b32dc 100644
--- a/upload/install/opencart.sql
+++ b/upload/install/opencart.sql
@@ -3087,7 +3087,18 @@ INSERT INTO `oc_setting` (`setting_id`, `store_id`, `group`, `key`, `value`, `se
(127, 0, 'config', 'config_customer_group_display', 'a:1:{i:0;s:1:\"1\";}', 1),
(128, 0, 'config', 'config_robots', 'abot\r\ndbot\r\nebot\r\nhbot\r\nkbot\r\nlbot\r\nmbot\r\nnbot\r\nobot\r\npbot\r\nrbot\r\nsbot\r\ntbot\r\nvbot\r\nybot\r\nzbot\r\nbot.\r\nbot/\r\n_bot\r\n.bot\r\n/bot\r\n-bot\r\n:bot\r\n(bot\r\ncrawl\r\nslurp\r\nspider\r\nseek\r\naccoona\r\nacoon\r\nadressendeutschland\r\nah-ha.com\r\nahoy\r\naltavista\r\nananzi\r\nanthill\r\nappie\r\narachnophilia\r\narale\r\naraneo\r\naranha\r\narchitext\r\naretha\r\narks\r\nasterias\r\natlocal\r\natn\r\natomz\r\naugurfind\r\nbackrub\r\nbannana_bot\r\nbaypup\r\nbdfetch\r\nbig brother\r\nbiglotron\r\nbjaaland\r\nblackwidow\r\nblaiz\r\nblog\r\nblo.\r\nbloodhound\r\nboitho\r\nbooch\r\nbradley\r\nbutterfly\r\ncalif\r\ncassandra\r\nccubee\r\ncfetch\r\ncharlotte\r\nchurl\r\ncienciaficcion\r\ncmc\r\ncollective\r\ncomagent\r\ncombine\r\ncomputingsite\r\ncsci\r\ncurl\r\ncusco\r\ndaumoa\r\ndeepindex\r\ndelorie\r\ndepspid\r\ndeweb\r\ndie blinde kuh\r\ndigger\r\nditto\r\ndmoz\r\ndocomo\r\ndownload express\r\ndtaagent\r\ndwcp\r\nebiness\r\nebingbong\r\ne-collector\r\nejupiter\r\nemacs-w3 search engine\r\nesther\r\nevliya celebi\r\nezresult\r\nfalcon\r\nfelix ide\r\nferret\r\nfetchrover\r\nfido\r\nfindlinks\r\nfireball\r\nfish search\r\nfouineur\r\nfunnelweb\r\ngazz\r\ngcreep\r\ngenieknows\r\ngetterroboplus\r\ngeturl\r\nglx\r\ngoforit\r\ngolem\r\ngrabber\r\ngrapnel\r\ngralon\r\ngriffon\r\ngromit\r\ngrub\r\ngulliver\r\nhamahakki\r\nharvest\r\nhavindex\r\nhelix\r\nheritrix\r\nhku www octopus\r\nhomerweb\r\nhtdig\r\nhtml index\r\nhtml_analyzer\r\nhtmlgobble\r\nhubater\r\nhyper-decontextualizer\r\nia_archiver\r\nibm_planetwide\r\nichiro\r\niconsurf\r\niltrovatore\r\nimage.kapsi.net\r\nimagelock\r\nincywincy\r\nindexer\r\ninfobee\r\ninformant\r\ningrid\r\ninktomisearch.com\r\ninspector web\r\nintelliagent\r\ninternet shinchakubin\r\nip3000\r\niron33\r\nisraeli-search\r\nivia\r\njack\r\njakarta\r\njavabee\r\njetbot\r\njumpstation\r\nkatipo\r\nkdd-explorer\r\nkilroy\r\nknowledge\r\nkototoi\r\nkretrieve\r\nlabelgrabber\r\nlachesis\r\nlarbin\r\nlegs\r\nlibwww\r\nlinkalarm\r\nlink validator\r\nlinkscan\r\nlockon\r\nlwp\r\nlycos\r\nmagpie\r\nmantraagent\r\nmapoftheinternet\r\nmarvin/\r\nmattie\r\nmediafox\r\nmediapartners\r\nmercator\r\nmerzscope\r\nmicrosoft url control\r\nminirank\r\nmiva\r\nmj12\r\nmnogosearch\r\nmoget\r\nmonster\r\nmoose\r\nmotor\r\nmultitext\r\nmuncher\r\nmuscatferret\r\nmwd.search\r\nmyweb\r\nnajdi\r\nnameprotect\r\nnationaldirectory\r\nnazilla\r\nncsa beta\r\nnec-meshexplorer\r\nnederland.zoek\r\nnetcarta webmap engine\r\nnetmechanic\r\nnetresearchserver\r\nnetscoop\r\nnewscan-online\r\nnhse\r\nnokia6682/\r\nnomad\r\nnoyona\r\nnutch\r\nnzexplorer\r\nobjectssearch\r\noccam\r\nomni\r\nopen text\r\nopenfind\r\nopenintelligencedata\r\norb search\r\nosis-project\r\npack rat\r\npageboy\r\npagebull\r\npage_verifier\r\npanscient\r\nparasite\r\npartnersite\r\npatric\r\npear.\r\npegasus\r\nperegrinator\r\npgp key agent\r\nphantom\r\nphpdig\r\npicosearch\r\npiltdownman\r\npimptrain\r\npinpoint\r\npioneer\r\npiranha\r\nplumtreewebaccessor\r\npogodak\r\npoirot\r\npompos\r\npoppelsdorf\r\npoppi\r\npopular iconoclast\r\npsycheclone\r\npublisher\r\npython\r\nrambler\r\nraven search\r\nroach\r\nroad runner\r\nroadhouse\r\nrobbie\r\nrobofox\r\nrobozilla\r\nrules\r\nsalty\r\nsbider\r\nscooter\r\nscoutjet\r\nscrubby\r\nsearch.\r\nsearchprocess\r\nsemanticdiscovery\r\nsenrigan\r\nsg-scout\r\nshai''hulud\r\nshark\r\nshopwiki\r\nsidewinder\r\nsift\r\nsilk\r\nsimmany\r\nsite searcher\r\nsite valet\r\nsitetech-rover\r\nskymob.com\r\nsleek\r\nsmartwit\r\nsna-\r\nsnappy\r\nsnooper\r\nsohu\r\nspeedfind\r\nsphere\r\nsphider\r\nspinner\r\nspyder\r\nsteeler/\r\nsuke\r\nsuntek\r\nsupersnooper\r\nsurfnomore\r\nsven\r\nsygol\r\nszukacz\r\ntach black widow\r\ntarantula\r\ntempleton\r\n/teoma\r\nt-h-u-n-d-e-r-s-t-o-n-e\r\ntheophrastus\r\ntitan\r\ntitin\r\ntkwww\r\ntoutatis\r\nt-rex\r\ntutorgig\r\ntwiceler\r\ntwisted\r\nucsd\r\nudmsearch\r\nurl check\r\nupdated\r\nvagabondo\r\nvalkyrie\r\nverticrawl\r\nvictoria\r\nvision-search\r\nvolcano\r\nvoyager/\r\nvoyager-hc\r\nw3c_validator\r\nw3m2\r\nw3mir\r\nwalker\r\nwallpaper\r\nwanderer\r\nwauuu\r\nwavefire\r\nweb core\r\nweb hopper\r\nweb wombat\r\nwebbandit\r\nwebcatcher\r\nwebcopy\r\nwebfoot\r\nweblayers\r\nweblinker\r\nweblog monitor\r\nwebmirror\r\nwebmonkey\r\nwebquest\r\nwebreaper\r\nwebsitepulse\r\nwebsnarf\r\nwebstolperer\r\nwebvac\r\nwebwalk\r\nwebwatch\r\nwebwombat\r\nwebzinger\r\nwget\r\nwhizbang\r\nwhowhere\r\nwild ferret\r\nworldlight\r\nwwwc\r\nwwwster\r\nxenu\r\nxget\r\nxift\r\nxirq\r\nyandex\r\nyanga\r\nyeti\r\nyodao\r\nzao\r\nzippp\r\nzyborg', 0),
(129, 0, 'config', 'config_password', '1', 0),
-(130, 0, 'config', 'config_product_count', '1', 0);
+(130, 0, 'config', 'config_product_count', '1', 0)
+(131, 0, 'config', 'config_image_option_width','50',0),
+(132, 0, 'config', 'config_image_option_height','50',0),
+(133, 0, 'config', 'config_image_option_resize_type','default',0),
+(134, 0, 'config', 'config_image_thumb_resize_type', 'default', 0),
+(135, 0, 'config', 'config_image_popup_resize_type', 'default', 0),
+(136, 0, 'config', 'config_image_category_resize_type', 'default', 0),
+(137, 0, 'config', 'config_image_related_resize_type', 'default', 0),
+(138, 0, 'config', 'config_image_compare_resize_type', 'default', 0),
+(139, 0, 'config', 'config_image_wishlist_resize_type', 'default', 0),
+(140, 0, 'config', 'config_image_additional_resize_type', 'default', 0),
+(141, 0, 'config', 'config_image_cart_resize_type', 'default', 0);
-- --------------------------------------------------------
commit d8ea5cbc98ffe38e2d3c0207f30b6c95b6980888
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Fri Jan 4 03:49:13 2013 +0200
added resize_type to default installed modules on sql
diff --git a/upload/install/opencart.sql b/upload/install/opencart.sql
index 62f50a9..6a10061 100644
--- a/upload/install/opencart.sql
+++ b/upload/install/opencart.sql
@@ -2994,9 +2994,9 @@ INSERT INTO `oc_setting` (`setting_id`, `store_id`, `group`, `key`, `value`, `se
(35, 0, 'flat', 'flat_status', '1', 0),
(36, 0, 'flat', 'flat_geo_zone_id', '0', 0),
(37, 0, 'flat', 'flat_tax_class_id', '9', 0),
-(38, 0, 'carousel', 'carousel_module', 'a:1:{i:0;a:9:{s:9:"banner_id";s:1:"8";s:5:"limit";s:1:"5";s:6:"scroll";s:1:"3";s:5:"width";s:2:"80";s:6:"height";s:2:"80";s:9:"layout_id";s:1:"1";s:8:"position";s:14:"content_bottom";s:6:"status";s:1:"1";s:10:"sort_order";s:2:"-1";}}', 1),
+(38, 0, 'carousel', 'carousel_module', 'a:1:{i:0;a:10:{s:9:"banner_id";s:1:"8";s:5:"limit";s:1:"5";s:6:"scroll";s:1:"3";s:5:"width";s:2:"80";s:6:"height";s:2:"80";s:11:"resize_type";s:7:"default";s:9:"layout_id";s:1:"1";s:8:"position";s:14:"content_bottom";s:6:"status";s:1:"1";s:10:"sort_order";s:2:"-1";}}', 1),
(39, 0, 'featured', 'featured_product', '43,40,42,49,46,47,28', 0),
-(40, 0, 'featured', 'featured_module', 'a:1:{i:0;a:7:{s:5:"limit";s:1:"6";s:11:"image_width";s:2:"80";s:12:"image_height";s:2:"80";s:9:"layout_id";s:1:"1";s:8:"position";s:11:"content_top";s:6:"status";s:1:"1";s:10:"sort_order";s:1:"2";}}', 1),
+(40, 0, 'featured', 'featured_module', 'a:1:{i:0;a:8:{s:5:"limit";s:1:"6";s:11:"image_width";s:2:"80";s:12:"image_height";s:2:"80";s:11:"resize_type";s:7:"default";s:9:"layout_id";s:1:"1";s:8:"position";s:11:"content_top";s:6:"status";s:1:"1";s:10:"sort_order";s:1:"2";}}', 1),
(41, 0, 'flat', 'flat_cost', '5.00', 0),
(42, 0, 'credit', 'credit_sort_order', '7', 0),
(43, 0, 'credit', 'credit_status', '1', 0),
@@ -3064,8 +3064,8 @@ INSERT INTO `oc_setting` (`setting_id`, `store_id`, `group`, `key`, `value`, `se
(105, 0, 'config', 'config_weight_class_id', '1', 0),
(106, 0, 'config', 'config_currency_auto', '1', 0),
(107, 0, 'config', 'config_currency', 'USD', 0),
-(108, 0, 'slideshow', 'slideshow_module', 'a:1:{i:0;a:7:{s:9:"banner_id";s:1:"7";s:5:"width";s:3:"980";s:6:"height";s:3:"280";s:9:"layout_id";s:1:"1";s:8:"position";s:11:"content_top";s:6:"status";s:1:"1";s:10:"sort_order";s:1:"1";}}', 1),
-(109, 0, 'banner', 'banner_module', 'a:1:{i:0;a:7:{s:9:"banner_id";s:1:"6";s:5:"width";s:3:"182";s:6:"height";s:3:"182";s:9:"layout_id";s:1:"3";s:8:"position";s:11:"column_left";s:6:"status";s:1:"1";s:10:"sort_order";s:1:"3";}}', 1),
+(108, 0, 'slideshow', 'slideshow_module', 'a:1:{i:0;a:8:{s:9:"banner_id";s:1:"7";s:5:"width";s:3:"980";s:6:"height";s:3:"280";s:11:"resize_type";s:7:"default";s:9:"layout_id";s:1:"1";s:8:"position";s:11:"content_top";s:6:"status";s:1:"1";s:10:"sort_order";s:1:"1";}}', 1),
+(109, 0, 'banner', 'banner_module', 'a:1:{i:0;a:8:{s:9:"banner_id";s:1:"6";s:5:"width";s:3:"182";s:6:"height";s:3:"182";s:11:"resize_type";s:7:"default";s:9:"layout_id";s:1:"3";s:8:"position";s:11:"column_left";s:6:"status";s:1:"1";s:10:"sort_order";s:1:"3";}}', 1),
(110, 0, 'config', 'config_name', 'Your Store', 0),
(111, 0, 'config', 'config_owner', 'Your Name', 0),
(112, 0, 'config', 'config_address', 'Address 1', 0),
commit b8f5190a1d6f3463d2c9e5710abb2bee1b7ac6e8
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Fri Jan 4 03:35:35 2013 +0200
added resize type to bestseller modules
diff --git a/upload/admin/controller/module/bestseller.php b/upload/admin/controller/module/bestseller.php
index 1eba43d..0bb95df 100644
--- a/upload/admin/controller/module/bestseller.php
+++ b/upload/admin/controller/module/bestseller.php
@@ -27,6 +27,10 @@ class ControllerModuleBestSeller extends Controller {
21 $this->data['text_content_bottom'] = $this->language->get('text_content_bottom');
$this->data['text_column_left'] = $this->language->get('text_column_left');
$this->data['text_column_right'] = $this->language->get('text_column_right');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_limit'] = $this->language->get('entry_limit');
$this->data['entry_image'] = $this->language->get('entry_image');
diff --git a/upload/admin/language/english/module/bestseller.php b/upload/admin/language/english/module/bestseller.php
index 23b0311..1a60710 100644
--- a/upload/admin/language/english/module/bestseller.php
+++ b/upload/admin/language/english/module/bestseller.php
@@ -12,7 +12,7 @@ $_['text_column_right'] = 'Column Right';
// Entry
$_['entry_limit'] = 'Limit:';
-$_['entry_image'] = 'Image (W x H):';
+$_['entry_image'] = 'Image (W x H) and Resize Type:';
$_['entry_layout'] = 'Layout:';
$_['entry_position'] = 'Position:';
$_['entry_status'] = 'Status:';
diff --git a/upload/admin/view/template/module/bestseller.tpl b/upload/admin/view/template/module/bestseller.tpl
index 1cc66ff..b130420 100644
--- a/upload/admin/view/template/module/bestseller.tpl
+++ b/upload/admin/view/template/module/bestseller.tpl
@@ -34,6 +34,11 @@
<td class="left"><input type="text" name="bestseller_module[<?php echo $module_row; ?>][limit]" value="<?php echo $module['limit']; ?>" size="1" /></td>
<td class="left"><input type="text" name="bestseller_module[<?php echo $module_row; ?>][image_width]" value="<?php echo $module['image_width']; ?>" size="3" />
<input type="text" name="bestseller_module[<?php echo $module_row; ?>][image_height]" value="<?php echo $module['image_height']; ?>" size="3" />
+ <select name="bestseller_module[<?php echo $module_row; ?>][resize_type]">
+ <option value="default"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if (isset($error_image[$module_row])) { ?>
<span class="error"><?php echo $error_image[$module_row]; ?></span>
<?php } ?></td>
@@ -101,7 +106,12 @@ function addModule() {
html = '<tbody id="module-row' + module_row + '">';
html += ' <tr>';
html += ' <td class="left"><input type="text" name="bestseller_module[' + module_row + '][limit]" value="5" size="1" /></td>';
- html += ' <td class="left"><input type="text" name="bestseller_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="bestseller_module[' + module_row + '][image_height]" value="80" size="3" /></td>';
+ html += ' <td class="left"><input type="text" name="bestseller_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="bestseller_module[' + module_row + '][image_height]" value="80" size="3" />';
+ html += ' <select name="bestseller_module[' + module_row + '][resize_type]">';
+ html += ' <option value="default"><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
+ html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
+ html += ' </select></td>';
html += ' <td class="left"><select name="bestseller_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
diff --git a/upload/catalog/controller/module/bestseller.php b/upload/catalog/controller/module/bestseller.php
index 48bb2f3..7bb6ad3 100644
--- a/upload/catalog/controller/module/bestseller.php
+++ b/upload/catalog/controller/module/bestseller.php
@@ -17,7 +17,7 @@ class ControllerModuleBestSeller extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
+ $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height'], $setting['resize_type']);
} else {
$image = false;
}
commit 3dfb2e5ce1543f263184b7f231702bfe3b316f27
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Fri Jan 4 03:27:56 2013 +0200
added resize type to latest and special modules
diff --git a/upload/admin/controller/module/latest.php b/upload/admin/controller/module/latest.php
index 4197b08..8f02cfc 100644
--- a/upload/admin/controller/module/latest.php
+++ b/upload/admin/controller/module/latest.php
@@ -27,6 +27,10 @@ class ControllerModuleLatest extends Controller {
$this->data['text_content_bottom'] = $this->language->get('text_content_bottom');
$this->data['text_column_left'] = $this->language->get('text_column_left');
$this->data['text_column_right'] = $this->language->get('text_column_right');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_limit'] = $this->language->get('entry_limit');
$this->data['entry_image'] = $this->language->get('entry_image');
diff --git a/upload/admin/controller/module/special.php b/upload/admin/controller/module/special.php
index 4c057ff..012063b 100644
--- a/upload/admin/controller/module/special.php
+++ b/upload/admin/controller/module/special.php
@@ -1,4 +1,8 @@
-<?php
+
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');<?php
class ControllerModulespecial extends Controller {
private $error = array();
@@ -27,6 +31,10 @@ class ControllerModulespecial extends Controller {
$this->data['text_content_bottom'] = $this->language->get('text_content_bottom');
$this->data['text_column_left'] = $this->language->get('text_column_left');
$this->data['text_column_right'] = $this->language->get('text_column_right');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_limit'] = $this->language->get('entry_limit');
$this->data['entry_image'] = $this->language->get('entry_image');
diff --git a/upload/admin/language/english/module/latest.php b/upload/admin/language/english/module/latest.php
index 804dd35..2adff35 100644
--- a/upload/admin/language/english/module/latest.php
+++ b/upload/admin/language/english/module/latest.php
@@ -12,7 +12,7 @@ $_['text_column_right'] = 'Column Right';
// Entry
$_['entry_limit'] = 'Limit:';
-$_['entry_image'] = 'Image (W x H):';
+$_['entry_image'] = 'Image (W x H) and Resize Type:';
$_['entry_layout'] = 'Layout:';
$_['entry_position'] = 'Position:';
$_['entry_status'] = 'Status:';
diff --git a/upload/admin/language/english/module/special.php b/upload/admin/language/english/module/special.php
index 9e43d6f..e331124 100644
--- a/upload/admin/language/english/module/special.php
+++ b/upload/admin/language/english/module/special.php
@@ -12,7 +12,7 @@ $_['text_column_right'] = 'Column Right';
// Entry
$_['entry_limit'] = 'Limit:';
-$_['entry_image'] = 'Image (W x H):';
+$_['entry_image'] = 'Image (W x H) and Resize Type:';
$_['entry_layout'] = 'Layout:';
$_['entry_position'] = 'Position:';
$_['entry_status'] = 'Status:';
diff --git a/upload/admin/view/template/module/latest.tpl b/upload/admin/view/template/module/latest.tpl
index c6695fc..605115c 100644
--- a/upload/admin/view/template/module/latest.tpl
+++ b/upload/admin/view/template/module/latest.tpl
@@ -34,6 +34,11 @@
<td class="left"><input type="text" name="latest_module[<?php echo $module_row; ?>][limit]" value="<?php echo $module['limit']; ?>" size="1" /></td>
<td class="left"><input type="text" name="latest_module[<?php echo $module_row; ?>][image_width]" value="<?php echo $module['image_width']; ?>" size="3" />
<input type="text" name="latest_module[<?php echo $module_row; ?>][image_height]" value="<?php echo $module['image_height']; ?>" size="3" />
+ <select name="latest_module[<?php echo $module_row; ?>][resize_type]">
+ <option value="default"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if (isset($error_image[$module_row])) { ?>
<span class="error"><?php echo $error_image[$module_row]; ?></span>
<?php } ?></td>
@@ -101,7 +106,12 @@ function addModule() {
html = '<tbody id="module-row' + module_row + '">';
html += ' <tr>';
html += ' <td class="left"><input type="text" name="latest_module[' + module_row + '][limit]" value="5" size="1" /></td>';
- html += ' <td class="left"><input type="text" name="latest_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="latest_module[' + module_row + '][image_height]" value="80" size="3" /></td>';
+ html += ' <td class="left"><input type="text" name="latest_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="latest_module[' + module_row + '][image_height]" value="80" size="3" />';
+ html += ' <select name="latest_module[' + module_row + '][resize_type]">';
+ html += ' <option value="default"><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
+ html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
+ html += ' </select></td>';
html += ' <td class="left"><select name="latest_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
diff --git a/upload/admin/view/template/module/special.tpl b/upload/admin/view/template/module/special.tpl
index d158006..edf3603 100644
--- a/upload/admin/view/template/module/special.tpl
+++ b/upload/admin/view/template/module/special.tpl
@@ -34,6 +34,11 @@
<td class="left"><input type="text" name="special_module[<?php echo $module_row; ?>][limit]" value="<?php echo $module['limit']; ?>" size="1" /></td>
<td class="left"><input type="text" name="special_module[<?php echo $module_row; ?>][image_width]" value="<?php echo $module['image_width']; ?>" size="3" />
<input type="text" name="special_module[<?php echo $module_row; ?>][image_height]" value="<?php echo $module['image_height']; ?>" size="3" />
+ <select name="special_module[<?php echo $module_row; ?>][resize_type]">
+ <option value="default"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if (isset($error_image[$module_row])) { ?>
<span class="error"><?php echo $error_image[$module_row]; ?></span>
<?php } ?></td>
@@ -101,7 +106,12 @@ function addModule() {
html = '<tbody id="module-row' + module_row + '">';
html += ' <tr>';
html += ' <td class="left"><input type="text" name="special_module[' + module_row + '][limit]" value="5" size="1" /></td>';
- html += ' <td class="left"><input type="text" name="special_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="special_module[' + module_row + '][image_height]" value="80" size="3" /></td>';
+ html += ' <td class="left"><input type="text" name="special_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="special_module[' + module_row + '][image_height]" value="80" size="3" />';
+ html += ' <select name="special_module[' + module_row + '][resize_type]">';
+ html += ' <option value="default"><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
+ html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
+ html += ' </select></td>';
html += ' <td class="left"><select name="special_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
diff --git a/upload/catalog/controller/module/latest.php b/upload/catalog/controller/module/latest.php
index df650f8..2c062c9 100644
--- a/upload/catalog/controller/module/latest.php
+++ b/upload/catalog/controller/module/latest.php
@@ -24,7 +24,7 @@ class ControllerModuleLatest extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
+ $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height'], $setting['resize_type']);
} else {
$image = false;
}
diff --git a/upload/catalog/controller/module/special.php b/upload/catalog/controller/module/special.php
index 08b65b7..ea9ee99 100644
--- a/upload/catalog/controller/module/special.php
+++ b/upload/catalog/controller/module/special.php
@@ -24,7 +24,7 @@ class ControllerModuleSpecial extends Controller {
foreach ($results as $result) {
if ($result['image']) {
- $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
+ $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height'], $setting['resize_type']);
} else {
$image = false;
}
commit bbc533eee57f847eb1542017db92f653e1119a10
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Fri Jan 4 03:17:31 2013 +0200
added resize type to slideshow and carousel modules
diff --git a/upload/admin/controller/module/carousel.php b/upload/admin/controller/module/carousel.php
index 38c33d6..4a0f653 100644
--- a/upload/admin/controller/module/carousel.php
+++ b/upload/admin/controller/module/carousel.php
@@ -26,6 +26,10 @@ class ControllerModuleCarousel extends Controller {
$this->data['text_column_left'] = $this->language->get('text_column_left');
$this->data['text_column_right'] = $this->language->get('text_column_right');
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
+
$this->data['entry_banner'] = $this->language->get('entry_banner');
$this->data['entry_limit'] = $this->language->get('entry_limit');
$this->data['entry_scroll'] = $this->language->get('entry_scroll');
diff --git a/upload/admin/controller/module/slideshow.php b/upload/admin/controller/module/slideshow.php
index 31c6457..5217682 100644
--- a/upload/admin/controller/module/slideshow.php
+++ b/upload/admin/controller/module/slideshow.php
@@ -25,6 +25,10 @@ class ControllerModuleSlideshow extends Controller {
$this->data['text_content_bottom'] = $this->language->get('text_content_bottom');
$this->data['text_column_left'] = $this->language->get('text_column_left');
$this->data['text_column_right'] = $this->language->get('text_column_right');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_banner'] = $this->language->get('entry_banner');
$this->data['entry_dimension'] = $this->language->get('entry_dimension');
diff --git a/upload/admin/language/english/module/carousel.php b/upload/admin/language/english/module/carousel.php
index b21916b..26e6825 100644
--- a/upload/admin/language/english/module/carousel.php
+++ b/upload/admin/language/english/module/carousel.php
@@ -14,7 +14,7 @@ $_['text_column_right'] = 'Column Right';
$_['entry_banner'] = 'Banner:';
$_['entry_limit'] = 'Limit:';
$_['entry_scroll'] = 'Scroll:';
-$_['entry_image'] = 'Image (W x H):';
+$_['entry_image'] = 'Image (W x H) and Resize Type:';
$_['entry_layout'] = 'Layout:';
$_['entry_position'] = 'Position:';
$_['entry_status'] = 'Status:';
diff --git a/upload/admin/language/english/module/slideshow.php b/upload/admin/language/english/module/slideshow.php
index 5462c96..70a44cb 100644
--- a/upload/admin/language/english/module/slideshow.php
+++ b/upload/admin/language/english/module/slideshow.php
@@ -12,7 +12,7 @@ $_['text_column_right'] = 'Column Right';
// Entry
$_['entry_banner'] = 'Banner:';
-$_['entry_dimension'] = 'Dimension (W x H):';
+$_['entry_dimension'] = 'Dimension (W x H) and Resize Type:';
$_['entry_layout'] = 'Layout:';
$_['entry_position'] = 'Position:';
$_['entry_status'] = 'Status:';
diff --git a/upload/admin/view/template/module/carousel.tpl b/upload/admin/view/template/module/carousel.tpl
index bd8edfb..7824bf3 100644
--- a/upload/admin/view/template/module/carousel.tpl
+++ b/upload/admin/view/template/module/carousel.tpl
@@ -46,6 +46,11 @@
<td class="left"><input type="text" name="carousel_module[<?php echo $module_row; ?>][scroll]" value="<?php echo $module['scroll']; ?>" size="3" /></td>
<td class="left"><input type="text" name="carousel_module[<?php echo $module_row; ?>][width]" value="<?php echo $module['width']; ?>" size="3" />
<input type="text" name="carousel_module[<?php echo $module_row; ?>][height]" value="<?php echo $module['height']; ?>" size="3" />
+ <select name="carousel_module[<?php echo $module_row; ?>][resize_type]">
+ <option value="default"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if (isset($error_image[$module_row])) { ?>
<span class="error"><?php echo $error_image[$module_row]; ?></span>
<?php } ?></td>
@@ -119,7 +124,12 @@ function addModule() {
html += ' </select></td>';
html += ' <td class="left"><input type="text" name="carousel_module[' + module_row + '][limit]" value="5" size="1" /></td>';
html += ' <td class="left"><input type="text" name="carousel_module[' + module_row + '][scroll]" value="3" size="1" /></td>';
- html += ' <td class="left"><input type="text" name="carousel_module[' + module_row + '][width]" value="80" size="3" /> <input type="text" name="carousel_module[' + module_row + '][height]" value="80" size="3" /></td>';
+ html += ' <td class="left"><input type="text" name="carousel_module[' + module_row + '][width]" value="80" size="3" /> <input type="text" name="carousel_module[' + module_row + '][height]" value="80" size="3" />';
+ html += ' <select name="carousel_module[' + module_row + '][resize_type]">';
+ html += ' <option value="default"><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
+ html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
+ html += ' </select></td>';
html += ' <td class="left"><select name="carousel_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
diff --git a/upload/admin/view/template/module/slideshow.tpl b/upload/admin/view/template/module/slideshow.tpl
index aa4194f..42ccf72 100644
--- a/upload/admin/view/template/module/slideshow.tpl
+++ b/upload/admin/view/template/module/slideshow.tpl
@@ -42,6 +42,11 @@
</select></td>
<td class="left"><input type="text" name="slideshow_module[<?php echo $module_row; ?>][width]" value="<?php echo $module['width']; ?>" size="3" />
<input type="text" name="slideshow_module[<?php echo $module_row; ?>][height]" value="<?php echo $module['height']; ?>" size="3"/>
+ <select name="slideshow_module[<?php echo $module_row; ?>][resize_type]">
+ <option value="default"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if (isset($error_dimension[$module_row])) { ?>
<span class="error"><?php echo $error_dimension[$module_row]; ?></span>
<?php } ?></td>
@@ -113,7 +118,12 @@ function addModule() {
html += ' <option value="<?php echo $banner['banner_id']; ?>"><?php echo addslashes($banner['name']); ?></option>';
<?php } ?>
html += ' </select></td>';
- html += ' <td class="left"><input type="text" name="slideshow_module[' + module_row + '][width]" value="" size="3" /> <input type="text" name="slideshow_module[' + module_row + '][height]" value="" size="3" /></td>';
+ html += ' <td class="left"><input type="text" name="slideshow_module[' + module_row + '][width]" value="" size="3" /> <input type="text" name="slideshow_module[' + module_row + '][height]" value="" size="3" />';
+ html += ' <select name="slideshow_module[' + module_row + '][resize_type]">';
+ html += ' <option value="default"><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
+ html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
+ html += ' </select></td>';
html += ' <td class="left"><select name="slideshow_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
diff --git a/upload/catalog/controller/module/carousel.php b/upload/catalog/controller/module/carousel.php
index e35f805..5785785 100644
--- a/upload/catalog/controller/module/carousel.php
+++ b/upload/catalog/controller/module/carousel.php
@@ -26,7 +26,7 @@ class ControllerModuleCarousel extends Controller {
$this->data['banners'][] = array(
'title' => $result['title'],
'link' => $result['link'],
- 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'])
+ 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'], $setting['resize_type'])
);
}
}
diff --git a/upload/catalog/controller/module/slideshow.php b/upload/catalog/controller/module/slideshow.php
index 745b579..cb78771 100644
--- a/upload/catalog/controller/module/slideshow.php
+++ b/upload/catalog/controller/module/slideshow.php
@@ -27,7 +27,7 @@ class ControllerModuleSlideshow extends Controller {
$this->data['banners'][] = array(
'title' => $result['title'],
'link' => $result['link'],
- 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'])
+ 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'], $setting['resize_type'])
);
}
}
commit 9de07b668d73b02885cce6c782544963d8f247ba
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Fri Jan 4 02:58:26 2013 +0200
added resize type to banner module
diff --git a/upload/admin/controller/module/banner.php b/upload/admin/controller/module/banner.php
index 5422a57..96f3d64 100644
--- a/upload/admin/controller/module/banner.php
+++ b/upload/admin/controller/module/banner.php
@@ -25,6 +25,10 @@ class ControllerModuleBanner extends Controller {
$this->data['text_content_bottom'] = $this->language->get('text_content_bottom');
$this->data['text_column_left'] = $this->language->get('text_column_left');
$this->data['text_column_right'] = $this->language->get('text_column_right');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_banner'] = $this->language->get('entry_banner');
$this->data['entry_dimension'] = $this->language->get('entry_dimension');
diff --git a/upload/admin/language/english/module/banner.php b/upload/admin/language/english/module/banner.php
index 697f209..10fdc19 100644
--- a/upload/admin/language/english/module/banner.php
+++ b/upload/admin/language/english/module/banner.php
@@ -12,7 +12,7 @@ $_['text_column_right'] = 'Column Right';
// Entry
$_['entry_banner'] = 'Banner:';
-$_['entry_dimension'] = 'Dimension (W x H):';
+$_['entry_dimension'] = 'Dimension (W x H) and Resize Type:';
$_['entry_layout'] = 'Layout:';
$_['entry_position'] = 'Position:';
$_['entry_status'] = 'Status:';
diff --git a/upload/admin/view/template/module/banner.tpl b/upload/admin/view/template/module/banner.tpl
index c759caa..3b255e4 100644
--- a/upload/admin/view/template/module/banner.tpl
+++ b/upload/admin/view/template/module/banner.tpl
@@ -42,6 +42,11 @@
</select></td>
<td class="left"><input type="text" name="banner_module[<?php echo $module_row; ?>][width]" value="<?php echo $module['width']; ?>" size="3" />
<input type="text" name="banner_module[<?php echo $module_row; ?>][height]" value="<?php echo $module['height']; ?>" size="3" />
+ <select name="banner_module[<?php echo $module_row; ?>][resize_type]">
+ <option value="default"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if (isset($error_dimension[$module_row])) { ?>
<span class="error"><?php echo $error_dimension[$module_row]; ?></span>
<?php } ?></td>
@@ -113,7 +118,12 @@ function addModule() {
html += ' <option value="<?php echo $banner['banner_id']; ?>"><?php echo addslashes($banner['name']); ?></option>';
<?php } ?>
html += ' </select></td>';
- html += ' <td class="left"><input type="text" name="banner_module[' + module_row + '][width]" value="" size="3" /> <input type="text" name="banner_module[' + module_row + '][height]" value="" size="3" /></td>';
+ html += ' <td class="left"><input type="text" name="banner_module[' + module_row + '][width]" value="" size="3" /> <input type="text" name="banner_module[' + module_row + '][height]" value="" size="3" />';
+ html += ' <select name="banner_module[' + module_row + '][resize_type]">';
+ html += ' <option value="default"><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
+ html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
+ html += ' </select></td>';
html += ' <td class="left"><select name="banner_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
diff --git a/upload/admin/view/template/module/featured.tpl b/upload/admin/view/template/module/featured.tpl
index 2d50253..946090a 100644
--- a/upload/admin/view/template/module/featured.tpl
+++ b/upload/admin/view/template/module/featured.tpl
@@ -178,7 +178,7 @@ function addModule() {
html += ' <td class="left"><input type="text" name="featured_module[' + module_row + '][limit]" value="5" size="1" /></td>';
html += ' <td class="left"><input type="text" name="featured_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="featured_module[' + module_row + '][image_height]" value="80" size="3" />';
html += ' <select name="featured_module[' + module_row + '][resize_type]">';
- html += ' <option value=""><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="default"><?php echo $img_resize_type_d; ?></option>';
html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
html += ' </select></td>';
diff --git a/upload/catalog/controller/module/banner.php b/upload/catalog/controller/module/banner.php
index 65d49ce..e3838d5 100644
--- a/upload/catalog/controller/module/banner.php
+++ b/upload/catalog/controller/module/banner.php
@@ -17,7 +17,7 @@ class ControllerModuleBanner extends Controller {
$this->data['banners'][] = array(
'title' => $result['title'],
'link' => $result['link'],
- 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'])
+ 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'], $setting['resize_type'])
);
}
}
commit d9d2c50bf8986a892a3bd34e15c73e8edd22713d
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Fri Jan 4 02:49:58 2013 +0200
added resize type to featured module
diff --git a/upload/admin/controller/module/featured.php b/upload/admin/controller/module/featured.php
index 9270666..89f5766 100644
--- a/upload/admin/controller/module/featured.php
+++ b/upload/admin/controller/module/featured.php
@@ -25,6 +25,10 @@ class ControllerModuleFeatured extends Controller {
$this->data['text_content_bottom'] = $this->language->get('text_content_bottom');
$this->data['text_column_left'] = $this->language->get('text_column_left');
$this->data['text_column_right'] = $this->language->get('text_column_right');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_product'] = $this->language->get('entry_product');
$this->data['entry_limit'] = $this->language->get('entry_limit');
diff --git a/upload/admin/language/english/english.php b/upload/admin/language/english/english.php
index e567db9..1eab85e 100644
--- a/upload/admin/language/english/english.php
+++ b/upload/admin/language/english/english.php
@@ -103,6 +103,11 @@ $_['tab_transaction'] = 'Transactions';
$_['tab_voucher'] = 'Vouchers';
$_['tab_voucher_history'] = 'Voucher History';
+// Image Resize Type
+$_['img_resize_type_d'] = 'Resize according to default';
+$_['img_resize_type_w'] = 'Resize according to width';
+$_['img_resize_type_h'] = 'Resize according to height';
+
// Error
$_['error_upload_1'] = 'Warning: The uploaded file exceeds the upload_max_filesize directive in php.ini!';
$_['error_upload_2'] = 'Warning: The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form!';
diff --git a/upload/admin/language/english/module/featured.php b/upload/admin/language/english/module/featured.php
index b49ee08..12d5a59 100644
--- a/upload/admin/language/english/module/featured.php
+++ b/upload/admin/language/english/module/featured.php
@@ -13,7 +13,7 @@ $_['text_column_right'] = 'Column Right';
// Entry
$_['entry_product'] = 'Products:<br /><span class="help">(Autocomplete)</span>';
$_['entry_limit'] = 'Limit:';
-$_['entry_image'] = 'Image (W x H):';
+$_['entry_image'] = 'Image (W x H) and Resize Type:';
$_['entry_layout'] = 'Layout:';
$_['entry_position'] = 'Position:';
$_['entry_status'] = 'Status:';
diff --git a/upload/admin/view/template/module/featured.tpl b/upload/admin/view/template/module/featured.tpl
index a4e980d..2d50253 100644
--- a/upload/admin/view/template/module/featured.tpl
+++ b/upload/admin/view/template/module/featured.tpl
@@ -53,6 +53,11 @@
<td class="left"><input type="text" name="featured_module[<?php echo $module_row; ?>][limit]" value="<?php echo $module['limit']; ?>" size="1" /></td>
<td class="left"><input type="text" name="featured_module[<?php echo $module_row; ?>][image_width]" value="<?php echo $module['image_width']; ?>" size="3" />
<input type="text" name="featured_module[<?php echo $module_row; ?>][image_height]" value="<?php echo $module['image_height']; ?>" size="3" />
+ <select name="featured_module[<?php echo $module_row; ?>][resize_type]">
+ <option value="default"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( (isset($module['resize_type']) && $module['resize_type'] == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if (isset($error_image[$module_row])) { ?>
<span class="error"><?php echo $error_image[$module_row]; ?></span>
<?php } ?></td>
@@ -171,7 +176,12 @@ function addModule() {
html = '<tbody id="module-row' + module_row + '">';
html += ' <tr>';
html += ' <td class="left"><input type="text" name="featured_module[' + module_row + '][limit]" value="5" size="1" /></td>';
- html += ' <td class="left"><input type="text" name="featured_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="featured_module[' + module_row + '][image_height]" value="80" size="3" /></td>';
+ html += ' <td class="left"><input type="text" name="featured_module[' + module_row + '][image_width]" value="80" size="3" /> <input type="text" name="featured_module[' + module_row + '][image_height]" value="80" size="3" />';
+ html += ' <select name="featured_module[' + module_row + '][resize_type]">';
+ html += ' <option value=""><?php echo $img_resize_type_d; ?></option>';
+ html += ' <option value="w"><?php echo $img_resize_type_w; ?></option>';
+ html += ' <option value="h"><?php echo $img_resize_type_h; ?></option>';
+ html += ' </select></td>';
html += ' <td class="left"><select name="featured_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
diff --git a/upload/catalog/controller/module/featured.php b/upload/catalog/controller/module/featured.php
index 0ef3dd7..728dcc8 100644
--- a/upload/catalog/controller/module/featured.php
+++ b/upload/catalog/controller/module/featured.php
@@ -26,7 +26,7 @@ class ControllerModuleFeatured extends Controller {
if ($product_info) {
if ($product_info['image']) {
- $image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height']);
+ $image = $this->model_tool_image->resize($product_info['image'], $setting['image_width'], $setting['image_height'], $setting['resize_type']);
} else {
$image = false;
}
commit afc2eff60837abffc1011101c163912386f4f03c
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Thu Jan 10 16:49:49 2013 +0200
added image resize_type to setting/store. i guess, image resize_type patch is finished
diff --git a/upload/admin/controller/setting/store.php b/upload/admin/controller/setting/store.php
index a0bf152..0af1765 100644
--- a/upload/admin/controller/setting/store.php
+++ b/upload/admin/controller/setting/store.php
@@ -193,6 +193,10 @@ class ControllerSettingStore extends Controller {
21 $this->data['text_clear'] = $this->language->get('text_clear');
$this->data['text_shipping'] = $this->language->get('text_shipping');
$this->data['text_payment'] = $this->language->get('text_payment');
+
+ $this->data['img_resize_type_d'] = $this->language->get('img_resize_type_d');
+ $this->data['img_resize_type_w'] = $this->language->get('img_resize_type_w');
+ $this->data['img_resize_type_h'] = $this->language->get('img_resize_type_h');
$this->data['entry_url'] = $this->language->get('entry_url');
$this->data['entry_ssl'] = $this->language->get('entry_ssl');
@@ -233,6 +237,7 @@ class ControllerSettingStore extends Controller {
$this->data['entry_image_product'] = $this->language->get('entry_image_product');
$this->data['entry_image_additional'] = $this->language->get('entry_image_additional');
$this->data['entry_image_related'] = $this->language->get('entry_image_related');
+ $this->data['entry_image_option'] = $this->language->get('entry_image_option');
$this->data['entry_image_compare'] = $this->language->get('entry_image_compare');
$this->data['entry_image_wishlist'] = $this->language->get('entry_image_wishlist');
$this->data['entry_image_cart'] = $this->language->get('entry_image_cart');
@@ -337,6 +342,12 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['error_image_related'] = '';
}
+
+ if (isset($this->error['image_option'])) {
+ $this->data['error_image_option'] = $this->error['image_option'];
+ } else {
+ $this->data['error_image_option'] = '';
+ }
if (isset($this->error['image_compare'])) {
$this->data['error_image_compare'] = $this->error['image_compare'];
@@ -708,13 +719,6 @@ class ControllerSettingStore extends Controller {
$this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
- if (isset($this->request->post['config_image_category_height'])) {
- $this->data['config_image_category_height'] = $this->request->post['config_image_category_height'];
- } elseif (isset($store_info['config_image_category_height'])) {
- $this->data['config_image_category_height'] = $store_info['config_image_category_height'];
- } else {
- $this->data['config_image_category_height'] = 80;
- }
if (isset($this->request->post['config_image_thumb_width'])) {
$this->data['config_image_thumb_width'] = $this->request->post['config_image_thumb_width'];
@@ -723,6 +727,14 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['config_image_thumb_width'] = 228;
}
+
+ if (isset($this->request->post['config_image_thumb_resize_type'])) {
+ $this->data['config_image_thumb_resize_type'] = $this->request->post['config_image_thumb_resize_type'];
+ } elseif (isset($store_info['config_image_thumb_resize_type'])) {
+ $this->data['config_image_thumb_resize_type'] = $store_info['config_image_thumb_resize_type'];
+ } else {
+ $this->data['config_image_thumb_resize_type'] = 'default';
+ }
if (isset($this->request->post['config_image_thumb_height'])) {
$this->data['config_image_thumb_height'] = $this->request->post['config_image_thumb_height'];
@@ -739,6 +751,14 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['config_image_popup_width'] = 500;
}
+
+ if (isset($this->request->post['config_image_popup_resize_type'])) {
+ $this->data['config_image_popup_resize_type'] = $this->request->post['config_image_popup_resize_type'];
+ } elseif (isset($store_info['config_image_popup_resize_type'])) {
+ $this->data['config_image_popup_resize_type'] = $store_info['config_image_popup_resize_type'];
+ } else {
+ $this->data['config_image_popup_resize_type'] = 'default';
+ }
if (isset($this->request->post['config_image_popup_height'])) {
$this->data['config_image_popup_height'] = $this->request->post['config_image_popup_height'];
@@ -755,6 +775,14 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['config_image_product_width'] = 80;
}
+
+ if (isset($this->request->post['config_image_product_resize_type'])) {
+ $this->data['config_image_product_resize_type'] = $this->request->post['config_image_product_resize_type'];
+ } elseif (isset($store_info['config_image_product_resize_type'])) {
+ $this->data['config_image_product_resize_type'] = $store_info['config_image_product_resize_type'];
+ } else {
+ $this->data['config_image_product_resize_type'] = 'default';
+ }
if (isset($this->request->post['config_image_product_height'])) {
$this->data['config_image_product_height'] = $this->request->post['config_image_product_height'];
@@ -764,6 +792,14 @@ class ControllerSettingStore extends Controller {
$this->data['config_image_product_height'] = 80;
}
+ if (isset($this->request->post['config_image_category_height'])) {
+ $this->data['config_image_category_height'] = $this->request->post['config_image_category_height'];
+ } elseif (isset($store_info['config_image_category_height'])) {
+ $this->data['config_image_category_height'] = $store_info['config_image_category_height'];
+ } else {
+ $this->data['config_image_category_height'] = 80;
+ }
+
if (isset($this->request->post['config_image_category_width'])) {
$this->data['config_image_category_width'] = $this->request->post['config_image_category_width'];
} elseif (isset($store_info['config_image_category_width'])) {
@@ -772,6 +808,14 @@ class ControllerSettingStore extends Controller {
$this->data['config_image_category_width'] = 80;
}
+ if (isset($this->request->post['config_image_category_resize_type'])) {
+ $this->data['config_image_category_resize_type'] = $this->request->post['config_image_category_resize_type'];
+ } elseif (isset($store_info['config_image_category_resize_type'])) {
+ $this->data['config_image_category_resize_type'] = $store_info['config_image_category_resize_type'];
+ } else {
+ $this->data['config_image_category_resize_type'] = 'default';
+ }
+
if (isset($this->request->post['config_image_additional_width'])) {
$this->data['config_image_additional_width'] = $this->request->post['config_image_additional_width'];
} elseif (isset($store_info['config_image_additional_width'])) {
@@ -787,6 +831,14 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['config_image_additional_height'] = 74;
}
+
+ if (isset($this->request->post['config_image_additional_resize_type'])) {
+ $this->data['config_image_additional_resize_type'] = $this->request->post['config_image_additional_resize_type'];
+ } elseif (isset($store_info['config_image_additional_resize_type'])) {
+ $this->data['config_image_additional_resize_type'] = $store_info['config_image_additional_resize_type'];
+ } else {
+ $this->data['config_image_additional_resize_type'] = 'default';
+ }
if (isset($this->request->post['config_image_related_width'])) {
$this->data['config_image_related_width'] = $this->request->post['config_image_related_width'];
@@ -803,6 +855,38 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['config_image_related_height'] = 80;
}
+
+ if (isset($this->request->post['config_image_related_resize_type'])) {
+ $this->data['config_image_related_resize_type'] = $this->request->post['config_image_related_resize_type'];
+ } elseif (isset($store_info['config_image_related_resize_type'])) {
+ $this->data['config_image_related_resize_type'] = $store_info['config_image_related_resize_type'];
+ } else {
+ $this->data['config_image_related_resize_type'] = 'default';
+ }
+
+ if (isset($this->request->post['config_image_option_width'])) {
+ $this->data['config_image_option_width'] = $this->request->post['config_image_option_width'];
+ } elseif (isset($store_info['config_image_option_width'])) {
+ $this->data['config_image_option_width'] = $store_info['config_image_option_width'];
+ } else {
+ $this->data['config_image_option_width'] = 50;
+ }
+
+ if (isset($this->request->post['config_image_option_height'])) {
+ $this->data['config_image_option_height'] = $this->request->post['config_image_option_height'];
+ } elseif (isset($store_info['config_image_option_height'])) {
+ $this->data['config_image_option_height'] = $store_info['config_image_option_height'];
+ } else {
+ $this->data['config_image_option_height'] = 50;
+ }
+
+ if (isset($this->request->post['config_image_option_resize_type'])) {
+ $this->data['config_image_option_resize_type'] = $this->request->post['config_image_option_resize_type'];
+ } elseif (isset($store_info['config_image_option_resize_type'])) {
+ $this->data['config_image_option_resize_type'] = $store_info['config_image_option_resize_type'];
+ } else {
+ $this->data['config_image_option_resize_type'] = 'default';
+ }
if (isset($this->request->post['config_image_compare_width'])) {
$this->data['config_image_compare_width'] = $this->request->post['config_image_compare_width'];
@@ -819,6 +903,14 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['config_image_compare_height'] = 90;
}
+
+ if (isset($this->request->post['config_image_compare_resize_type'])) {
+ $this->data['config_image_compare_resize_type'] = $this->request->post['config_image_compare_resize_type'];
+ } elseif (isset($store_info['config_image_compare_resize_type'])) {
+ $this->data['config_image_compare_resize_type'] = $store_info['config_image_compare_resize_type'];
+ } else {
+ $this->data['config_image_compare_resize_type'] = 'default';
+ }
if (isset($this->request->post['config_image_wishlist_width'])) {
$this->data['config_image_wishlist_width'] = $this->request->post['config_image_wishlist_width'];
@@ -835,6 +927,14 @@ class ControllerSettingStore extends Controller {
} else {
$this->data['config_image_wishlist_height'] = 50;
}
+
+ if (isset($this->request->post['config_image_wishlist_resize_type'])) {
+ $this->data['config_image_wishlist_resize_type'] = $this->request->post['config_image_wishlist_resize_type'];
+ } elseif (isset($store_info['config_image_wishlist_resize_type'])) {
+ $this->data['config_image_wishlist_resize_type'] = $store_info['config_image_wishlist_resize_type'];
+ } else {
+ $this->data['config_image_wishlist_resize_type'] = 'default';
+ }
if (isset($this->request->post['config_image_cart_width'])) {
$this->data['config_image_cart_width'] = $this->request->post['config_image_cart_width'];
@@ -852,6 +952,14 @@ class ControllerSettingStore extends Controller {
$this->data['config_image_cart_height'] = 80;
}
+ if (isset($this->request->post['config_image_cart_resize_type'])) {
+ $this->data['config_image_cart_resize_type'] = $this->request->post['config_image_cart_resize_type'];
+ } elseif (isset($store_info['config_image_cart_resize_type'])) {
+ $this->data['config_image_cart_resize_type'] = $store_info['config_image_cart_resize_type'];
+ } else {
+ $this->data['config_image_cart_resize_type'] = 'default';
+ }
+
if (isset($this->request->post['config_secure'])) {
$this->data['config_secure'] = $this->request->post['config_secure'];
} elseif (isset($store_info['config_secure'])) {
@@ -930,6 +1038,10 @@ class ControllerSettingStore extends Controller {
$this->error['image_related'] = $this->language->get('error_image_related');
}
+ if (!$this->request->post['config_image_option_width'] || !$this->request->post['config_image_option_height']) {
+ $this->error['image_option'] = $this->language->get('error_image_option');
+ }
+
if (!$this->request->post['config_image_compare_width'] || !$this->request->post['config_image_compare_height']) {
$this->error['image_compare'] = $this->language->get('error_image_compare');
}
diff --git a/upload/admin/language/english/setting/store.php b/upload/admin/language/english/setting/store.php
index 4ba0277..c99e8ca 100644
--- a/upload/admin/language/english/setting/store.php
+++ b/upload/admin/language/english/setting/store.php
@@ -59,6 +59,7 @@ $_['entry_image_popup'] = 'Product Image Popup Size:';
$_['entry_image_product'] = 'Product Image List Size:';
$_['entry_image_additional'] = 'Additional Product Image Size:';
$_['entry_image_related'] = 'Related Product Image Size:';
+$_['entry_image_option'] = 'Product Option Image Size:';
$_['entry_image_compare'] = 'Compare Image Size:';
$_['entry_image_wishlist'] = 'Wish List Image Size:';
$_['entry_image_cart'] = 'Cart Image Size:';
@@ -82,6 +83,7 @@ $_['error_image_product'] = 'Product List Size dimensions required!';
$_['error_image_category'] = 'Category List Size dimensions required!';
$_['error_image_additional'] = 'Additional Product Image Size dimensions required!';
$_['error_image_related'] = 'Related Product Image Size dimensions required!';
+$_['error_image_option'] = 'Product Option Image Size dimensions required!';
$_['error_image_compare'] = 'Compare Image Size dimensions required!';
$_['error_image_wishlist'] = 'Wish List Image Size dimensions required!';
$_['error_image_cart'] = 'Cart Image Size dimensions required!';
diff --git a/upload/admin/view/template/setting/store_form.tpl b/upload/admin/view/template/setting/store_form.tpl
index 3701db9..29bd927 100644
--- a/upload/admin/view/template/setting/store_form.tpl
+++ b/upload/admin/view/template/setting/store_form.tpl
@@ -393,6 +393,11 @@
<td><input type="text" name="config_image_category_width" value="<?php echo $config_image_category_width; ?>" size="3" />
x
<input type="text" name="config_image_category_height" value="<?php echo $config_image_category_height; ?>" size="3" />
+ <select name="config_image_category_resize_type">
+ <option value="default"<?php echo ( ($config_image_category_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_category_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_category_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_category) { ?>
<span class="error"><?php echo $error_image_category; ?></span>
<?php } ?></td>
@@ -402,6 +407,11 @@
<td><input type="text" name="config_image_thumb_width" value="<?php echo $config_image_thumb_width; ?>" size="3" />
x
<input type="text" name="config_image_thumb_height" value="<?php echo $config_image_thumb_height; ?>" size="3" />
+ <select name="config_image_thumb_resize_type">
+ <option value="default"<?php echo ( ($config_image_thumb_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_thumb_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_thumb_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_thumb) { ?>
<span class="error"><?php echo $error_image_thumb; ?></span>
<?php } ?></td>
@@ -411,6 +421,11 @@
<td><input type="text" name="config_image_popup_width" value="<?php echo $config_image_popup_width; ?>" size="3" />
x
<input type="text" name="config_image_popup_height" value="<?php echo $config_image_popup_height; ?>" size="3" />
+ <select name="config_image_popup_resize_type">
+ <option value="default"<?php echo ( ($config_image_popup_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_popup_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_popup_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_popup) { ?>
<span class="error"><?php echo $error_image_popup; ?></span>
<?php } ?></td>
@@ -420,6 +435,11 @@
<td><input type="text" name="config_image_product_width" value="<?php echo $config_image_product_width; ?>" size="3" />
x
<input type="text" name="config_image_product_height" value="<?php echo $config_image_product_height; ?>" size="3" />
+ <select name="config_image_product_resize_type">
+ <option value="default"<?php echo ( ($config_image_product_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_product_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_product_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_product) { ?>
<span class="error"><?php echo $error_image_product; ?></span>
<?php } ?></td>
@@ -429,6 +449,11 @@
<td><input type="text" name="config_image_additional_width" value="<?php echo $config_image_additional_width; ?>" size="3" />
x
<input type="text" name="config_image_additional_height" value="<?php echo $config_image_additional_height; ?>" size="3" />
+ <select name="config_image_additional_resize_type">
+ <option value="default"<?php echo ( ($config_image_additional_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_additional_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_additional_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_additional) { ?>
<span class="error"><?php echo $error_image_additional; ?></span>
<?php } ?></td>
@@ -438,15 +463,39 @@
<td><input type="text" name="config_image_related_width" value="<?php echo $config_image_related_width; ?>" size="3" />
x
<input type="text" name="config_image_related_height" value="<?php echo $config_image_related_height; ?>" size="3" />
+ <select name="config_image_related_resize_type">
+ <option value="default"<?php echo ( ($config_image_related_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_related_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_related_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_related) { ?>
<span class="error"><?php echo $error_image_related; ?></span>
<?php } ?></td>
</tr>
<tr>
+ <td><span class="required">*</span> <?php echo $entry_image_option; ?></td>
+ <td><input type="text" name="config_image_option_width" value="<?php echo $config_image_option_width; ?>" size="3" />
+ x
+ <input type="text" name="config_image_option_height" value="<?php echo $config_image_option_height; ?>" size="3" />
+ <select name="config_image_option_resize_type">
+ <option value="default"<?php echo ( ($config_image_option_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_option_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_option_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
+ <?php if ($error_image_option) { ?>
+ <span class="error"><?php echo $error_image_option; ?></span>
+ <?php } ?></td>
+ </tr>
+ <tr>
<td><span class="required">*</span> <?php echo $entry_image_compare; ?></td>
<td><input type="text" name="config_image_compare_width" value="<?php echo $config_image_compare_width; ?>" size="3" />
x
<input type="text" name="config_image_compare_height" value="<?php echo $config_image_compare_height; ?>" size="3" />
+ <select name="config_image_compare_resize_type">
+ <option value="default"<?php echo ( ($config_image_compare_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_compare_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_compare_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_compare) { ?>
<span class="error"><?php echo $error_image_compare; ?></span>
<?php } ?></td>
@@ -456,6 +505,11 @@
<td><input type="text" name="config_image_wishlist_width" value="<?php echo $config_image_wishlist_width; ?>" size="3" />
x
<input type="text" name="config_image_wishlist_height" value="<?php echo $config_image_wishlist_height; ?>" size="3" />
+ <select name="config_image_wishlist_resize_type">
+ <option value="default"<?php echo ( ($config_image_wishlist_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_wishlist_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_wishlist_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_wishlist) { ?>
<span class="error"><?php echo $error_image_wishlist; ?></span>
<?php } ?></td>
@@ -465,6 +519,11 @@
<td><input type="text" name="config_image_cart_width" value="<?php echo $config_image_cart_width; ?>" size="3" />
x
<input type="text" name="config_image_cart_height" value="<?php echo $config_image_cart_height; ?>" size="3" />
+ <select name="config_image_cart_resize_type">
+ <option value="default"<?php echo ( ($config_image_cart_resize_type == 'default')?(' selected'):('') ); ?>><?php echo $img_resize_type_d; ?></option>
+ <option value="w"<?php echo ( ($config_image_cart_resize_type == 'w')?(' selected'):('') ); ?>><?php echo $img_resize_type_w; ?></option>
+ <option value="h"<?php echo ( ($config_image_cart_resize_type == 'h')?(' selected'):('') ); ?>><?php echo $img_resize_type_h; ?></option>
+ </select>
<?php if ($error_image_cart) { ?>
<span class="error"><?php echo $error_image_cart; ?></span>
<?php } ?></td>
commit a47c88d71769504c271849f97719b6d1a87c5165
Author: Haydar Kulekci <haydar.kulekci@reformo.net>
Date: Mon Dec 31 15:18:58 2012 +0200
image tool improvement about scale according to width, height, default
diff --git a/upload/catalog/model/tool/image.php b/upload/catalog/model/tool/image.php
index a0f0211..8e6c4d4 100644
--- a/upload/catalog/model/tool/image.php
+++ b/upload/catalog/model/tool/image.php
@@ -1,6 +1,17 @@
<?php
class ModelToolImage extends Model {
-21public function resize($filename, $width, $height) {
+ /**
+ *
+ * @param filename string
+ * @param width
+ * @param height
+ * @param type char [default, w, h]
+ * default = scale with white space,
+ * w = fill according to width,
+ * h = fill according to height
+ *
+ */
+ public function resize($filename, $width, $height, $type = "") {
if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
@@ -10,7 +21,7 @@ class ModelToolImage extends Model {
$extension = $info['extension'];
$old_image = $filename;
- $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
+ $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . $type .'.' . $extension;
if (!file_exists(DIR_IMAGE . $new_image) || (filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image))) {
$path = '';
@@ -29,7 +40,7 @@ class ModelToolImage extends Model {
if ($width_orig != $width || $height_orig != $height) {
$image = new Image(DIR_IMAGE . $old_image);
- $image->resize($width, $height);
+ $image->resize($width, $height, $type);
$image->save(DIR_IMAGE . $new_image);
} else {
copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
diff --git a/upload/system/library/image.php b/upload/system/library/image.php
index a7e220a..cdd7c7f 100644
--- a/upload/system/library/image.php
+++ b/upload/system/library/image.php
@@ -51,25 +51,49 @@ class Image {
imagedestroy($this->image);
}
- }
-
- public function resize($width = 0, $height = 0) {
+ }
+
+
+ /**
+ *
+ * @param width
+ * @param height
+ * @param type char [default, w, h]
+ * default = scale with white space,
+ * w = fill according to width,
+ * h = fill according to height
+ *
+ */
+ public function resize($width = 0, $height = 0, $type = "") {
if (!$this->info['width'] || !$this->info['height']) {
return;
}
$xpos = 0;
$ypos = 0;
-
+ $scale = 1;
+
$scale_w = $width / $this->info['width'];
$scale_h = $height / $this->info['height'];
- $scale = min($scale_w, $scale_h);
-
- if ($scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png') {
+ if ($type == "w"){
+
+ $scale = $scale_w;
+
+ }else if ($type == "h"){
+
+ $scale = $scale_h;
+
+ }else{
+
+ $scale = min($scale_w, $scale_h);
+
+ }
+
+ if ( $scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png' ) {
return;
}
-
+
$new_width = (int)($this->info['width'] * $scale);
$new_height = (int)($this->info['height'] * $scale);
$xpos = (int)(($width - $new_width) / 2);
commit a110b0237d3bb68fea13789bdefb1e6ff341f7f2
Author: Daniel <webmaster@opencart.com>
Date: Thu Jan 3 22:32:37 2013 +0800
image class update some var names
diff --git a/upload/system/library/image.php b/upload/system/library/image.php
index cdd7c7f..d3eb471 100644
--- a/upload/system/library/image.php
+++ b/upload/system/library/image.php
@@ -53,18 +53,17 @@ class Image {
21 }
}
-
/**
*
* @param width
* @param height
- * @param type char [default, w, h]
- * default = scale with white space,
- * w = fill according to width,
- * h = fill according to height
+ * @param default char [default, w, h]
+ * default = scale with white space,
+ * w = fill according to width,
+ * h = fill according to height
*
*/
- public function resize($width = 0, $height = 0, $type = "") {
+ public function resize($width = 0, $height = 0, $default = '') {
if (!$this->info['width'] || !$this->info['height']) {
return;
}
@@ -76,21 +75,15 @@ class Image {
$scale_w = $width / $this->info['width'];
$scale_h = $height / $this->info['height'];
- if ($type == "w"){
-
+ if ($default == 'w') {
$scale = $scale_w;
-
- }else if ($type == "h"){
-
+ } elseif ($default == 'h'){
$scale = $scale_h;
-
- }else{
-
+ } else {
$scale = min($scale_w, $scale_h);
-
}
- if ( $scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png' ) {
+ if ($scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png') {
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment