Skip to content

Commit

Permalink
Fix tool/image
Browse files Browse the repository at this point in the history
  • Loading branch information
shoputils committed Aug 29, 2017
1 parent 2becf8b commit 7bc6b37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions upload/admin/model/tool/image.php
Expand Up @@ -2,10 +2,10 @@
class ModelToolImage extends Model {
public function resize($filename, $width, $height) {
if (!is_file(DIR_IMAGE . $filename)) {
if (is_file(DIR_IMAGE . 'no_image.jpg')) {
$filename = 'no_image.jpg';
} elseif (is_file(DIR_IMAGE . 'no_image.png')) {
if (is_file(DIR_IMAGE . 'no_image.png')) {
$filename = 'no_image.png';
} elseif (is_file(DIR_IMAGE . 'no_image.jpg')) {
$filename = 'no_image.jpg';
} else {
return;
}
Expand Down Expand Up @@ -45,7 +45,7 @@ public function resize($filename, $width, $height) {
}

$imagepath_parts = explode('/', $image_new);
$new_image = implode('/', array_map('rawurlencode', $imagepath_parts));
$image_new = implode('/', array_map('rawurlencode', $imagepath_parts));

if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
return HTTPS_CATALOG . 'image/' . $image_new;
Expand Down
12 changes: 6 additions & 6 deletions upload/catalog/model/tool/image.php
Expand Up @@ -2,10 +2,10 @@
class ModelToolImage extends Model {
public function resize($filename, $width, $height) {
if (!is_file(DIR_IMAGE . $filename)) {
if (is_file(DIR_IMAGE . 'no_image.jpg')) {
$filename = 'no_image.jpg';
} elseif (is_file(DIR_IMAGE . 'no_image.png')) {
if (is_file(DIR_IMAGE . 'no_image.png')) {
$filename = 'no_image.png';
} elseif (is_file(DIR_IMAGE . 'no_image.jpg')) {
$filename = 'no_image.jpg';
} else {
return;
}
Expand Down Expand Up @@ -45,12 +45,12 @@ public function resize($filename, $width, $height) {
}

$imagepath_parts = explode('/', $image_new);
$new_image = implode('/', array_map('rawurlencode', $imagepath_parts));
$image_new = implode('/', array_map('rawurlencode', $imagepath_parts));

if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
return $this->config->get('config_ssl') . 'image/' . $new_image;
return $this->config->get('config_ssl') . 'image/' . $image_new;
} else {
return $this->config->get('config_url') . 'image/' . $new_image;
return $this->config->get('config_url') . 'image/' . $image_new;
}
}
}

0 comments on commit 7bc6b37

Please sign in to comment.