diff --git a/classes/Scene.php b/classes/Scene.php
index 86b53036e..b3bc32f5a 100644
--- a/classes/Scene.php
+++ b/classes/Scene.php
@@ -116,19 +116,12 @@ class SceneCore extends ObjectModel
}
public function deleteImage($force_delete = false)
- {
- // Hack to prevent the main scene image from being deleted in AdminController::uploadImage() when a thumb image is uploaded
- if (isset($_FILES['thumb']) && (!isset($_FILES['image']) || empty($_FILES['image']['name'])))
- return true;
-
- if (parent::deleteImage())
- {
- if (file_exists($this->image_dir.'thumbs/'.$this->id.'-thumb_scene.'.$this->image_format)
- && !unlink($this->image_dir.'thumbs/'.$this->id.'-thumb_scene.'.$this->image_format))
- return false;
- }
- else
+ {
+ if (file_exists($this->image_dir.'thumbs/'.$this->id.'-m_scene_default.'.$this->image_format)
+ && !unlink($this->image_dir.'thumbs/'.$this->id.'-m_scene_default.'.$this->image_format))
return false;
+ if (!(isset($_FILES) && count($_FILES)))
+ return parent::deleteImage();
return true;
}
diff --git a/controllers/admin/AdminScenesController.php b/controllers/admin/AdminScenesController.php
index 7f9ef8b91..346a5543b 100644
--- a/controllers/admin/AdminScenesController.php
+++ b/controllers/admin/AdminScenesController.php
@@ -75,16 +75,15 @@ class AdminScenesControllerCore extends AdminController
$images_types = ImageType::getImagesTypes('scenes');
foreach ($images_types as $k => $image_type)
- {
- if ($image_type['name'] == 'scene_default' && isset($_FILES['image']))
+ {
+ if ($image_type['name'] == 'scene_default' AND isset($_FILES['image']) AND isset($_FILES['image']['tmp_name']) AND !$_FILES['image']['error'])
ImageManager::resize(
$base_img_path,
_PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg',
(int)$image_type['width'],
- (int)$image_type['height']
- );
+ (int)$image_type['height']);
else if ($image_type['name'] == 'm_scene_default')
- {
+ {
if (isset($_FILES['thumb']) && !$_FILES['thumb']['error'])
$base_thumb_path = _PS_SCENE_THUMB_IMG_DIR_.$obj->id.'.jpg';
else
@@ -93,8 +92,7 @@ class AdminScenesControllerCore extends AdminController
$base_thumb_path,
_PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg',
(int)$image_type['width'],
- (int)$image_type['height']
- );
+ (int)$image_type['height']);
}
}
}
@@ -207,20 +205,20 @@ class AdminScenesControllerCore extends AdminController
$this->addJqueryPlugin('imgareaselect');
$this->addJs(_PS_JS_DIR_.'admin-scene-cropping.js' );
$image_to_map_desc .= '
';
+ _THEME_SCENE_DIR_.$obj->id.'-scene_default.jpg?rand='.(int)rand().'" />
';
$image_to_map_desc .= '