Error when saving configuration without logo.
Luifer-dnk opened this issue · 1 comments
Luifer-dnk commented
Luifer-dnk commented
Fixed with:
Replace code on line 715 and more.
`if (isset($_FILES['image']) && is_uploaded_file($_FILES['image']['tmp_name'])) {
$type = Tools::strtolower(Tools::substr(strrchr($_FILES['image']['name'], '.'), 1));
$errorMsg = '';
$imagesize = @getimagesize($_FILES['image']['tmp_name']);
if (isset($_FILES['image']) &&
!empty($imagesize) &&
in_array(
Tools::strtolower(Tools::substr(strrchr($imagesize['mime'], '/'), 1)),
array(
'jpg',
'gif',
'jpeg',
'png'
)
) &&
in_array($type, array('jpg', 'gif', 'jpeg', 'png'))
) {
// Upload and resize image as before
$temp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
if ($error = ImageManager::validateUpload($_FILES['image'])) {
$this->postErrors[] = $this->l('Error uploading file.');
} elseif (!$temp_name || !move_uploaded_file($_FILES['image']['tmp_name'], $temp_name)) {
$this->postErrors[] = $this->l('Error moving uploaded file to temporary location.');
} elseif (!ImageManager::resize($temp_name, dirname(__FILE__).'/views/img/quotation.jpg', null, null, $type)) {
$this->postErrors[] = $this->l('Error resizing the image.');
}
}
if (isset($temp_name)) {
@unlink($temp_name);
}
} else {
// No image uploaded, skip image processing
}`
Greetings.