Post by amadeuslaca » Wed Jul 25, 2018 3:36 pm

Hi Team,
we have a furniture webshop. berone.hu This is opencart 1.5.6
if I'm looking for a product (for example konyha), I'll get this error message:
Notice: Array to string conversion in /web/marcellmobel/berone.hu/vqmod/vqcache/vq2-catalog_model_tool_image.php on line 15

I did not find a solution in google. Can you help?
Thanks

<?php
class ModelToolImage extends Model {
/**
*
* @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 = "") {
/**line 15*/ (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}

$info = pathinfo($filename);

$extension = $info['extension'];

$old_image = $filename;
$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 = '';

$directories = explode('/', dirname(str_replace('../', '', $new_image)));

foreach ($directories as $directory) {
$path = $path . '/' . $directory;

if (!file_exists(DIR_IMAGE . $path)) {
@mkdir(DIR_IMAGE . $path, 0777);
}
}

list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);

if ($width_orig != $width || $height_orig != $height) {
$image = new Image(DIR_IMAGE . $old_image);

if ($width > 200 || $height > 200) {
$image->watermark(DIR_IMAGE . 'watermark.png', 'center');
}

$image->resize($width, $height, $type);
$image->save(DIR_IMAGE . $new_image);
} else {
copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
}
}

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 . '" width="' . $width . '" height="' . $height;
} else {
return $this->config->get('config_url') . 'image/' . $new_image . '" width="' . $width . '" height="' . $height;
}
}
}
?>

Newbie

Posts

Joined
Fri Jul 06, 2018 9:15 pm

Post by IP_CAM » Thu Jul 26, 2018 2:34 am

/**line 15*/ (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
should look like:
/**line 15*/ if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
So, either, you forgot to add if above, or then, it would not exist ... ???
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 7 guests