[-] BO : Fix bug #PSCFV-7353 can not see the thumb for a scene

This commit is contained in:
gRoussac
2013-06-24 14:50:10 +02:00
parent ec426f170f
commit 50c88dc4de
2 changed files with 23 additions and 25 deletions
+18 -13
View File
@@ -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 .= '<br /><img id="large_scene_image" alt="" src="'.
_THEME_SCENE_DIR_.$obj->id.'-scene_default.jpg" /><br />';
_THEME_SCENE_DIR_.$obj->id.'-scene_default.jpg?rand='.(int)rand().'" /><br />';
$image_to_map_desc .= '
<div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;">
'.$this->l('Begin typing the first few letters of the product name, then select the product you are looking for from the drop-down list:').'
<br /><input type="text" value="" id="product_autocomplete_input" />
<br /><input type="text" value="" id="product_autocomplete_input" style="width: 450px"/>
<input type="button" class="button" value="'.$this->l('OK').'" onclick="$(this).prev().search();" />
<input type="button" class="button" value="'.$this->l('Delete').'" onclick="undoEdit();" />
</div>
';
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg'))
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.'thumbs/'.$obj->id.'-m_scene_default.jpg'))
$image_to_map_desc .= '<br/>
<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-m_scene_default.jpg" />
<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-m_scene_default.jpg?rand='.(int)rand().'" />
<br />';
$img_alt_desc = '';
@@ -229,7 +227,7 @@ class AdminScenesControllerCore extends AdminController
.$this->l('File size:').' '.(Tools::getMaxUploadSize() / 1024).''.$this->l('Kb max.').' '
.sprintf($this->l('Automatically resized to %1$d x %2$dpx (width x height).'),
$thumb_scene_image_type['width'], $thumb_scene_image_type['height']).'.<br />'
.$this->l('Note: To change image dimensions, please change the \'thumb_scene\' image type settings to the desired size (in Back Office > Preferences > Images).');
.$this->l('Note: To change image dimensions, please change the \'m_scene_default\' image type settings to the desired size (in Back Office > Preferences > Images).');
$input_img_alt = array(
'type' => 'file',
@@ -312,7 +310,14 @@ class AdminScenesControllerCore extends AdminController
if (!Tools::isSubmit('zones') || !count(Tools::getValue('zones')))
$this->errors[] = Tools::displayError('You should create at least one zone.');
}
if (Tools::isSubmit('delete'.$this->table))
{
if (Validate::isLoadedObject($object = $this->loadObject()))
$object->deleteImage(false);
else
return false;
}
parent::postProcess();
}
}