/**
  * @param Employee $object
  *
  * @return bool
  */
 protected function postImage($id)
 {
     $ret = parent::postImage($id);
     if (isset($_FILES['image']) && isset($_FILES['image']['tmp_name']) && !empty($_FILES['image']['tmp_name'])) {
         if ($error = ImageManager::validateUpload($_FILES['image'], 4000000)) {
             return $this->displayError($this->l('Invalid image'));
         } else {
             $path = _PS_MODULE_DIR_ . 'smartblog/images/' . $id . '.' . $this->imageType;
             $tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS');
             if (!$tmp_name) {
                 return false;
             }
             if (!move_uploaded_file($_FILES['image']['tmp_name'], $tmp_name)) {
                 return false;
             }
             // Evaluate the memory required to resize the image: if it's too much, you can't resize it.
             if (!ImageManager::checkImageMemoryLimit($tmp_name)) {
                 $this->errors[] = Tools::displayError('Due to memory limit restrictions, this image cannot be loaded. Please increase your memory_limit value via your server\'s configuration settings. ');
             }
             // Copy new image
             if (empty($this->errors) && !ImageManager::resize($tmp_name, $path, (int) $width, (int) $height, $ext ? $ext : $this->imageType)) {
                 $this->errors[] = Tools::displayError('An error occurred while uploading the image.');
             }
             if (count($this->errors)) {
                 return false;
             }
             if ($this->afterImageUpload()) {
                 unlink($tmp_name);
                 //  return true;
             }
             $posts_types = BlogImageType::GetImageAllType('post');
             foreach ($posts_types as $image_type) {
                 $dir = _PS_MODULE_DIR_ . 'smartblog/images/' . $id . '-' . stripslashes($image_type['type_name']) . '.jpg';
                 if (file_exists($dir)) {
                     unlink($dir);
                 }
             }
             foreach ($posts_types as $image_type) {
                 ImageManager::resize($path, _PS_MODULE_DIR_ . 'smartblog/images/' . $id . '-' . stripslashes($image_type['type_name']) . '.jpg', (int) $image_type['width'], (int) $image_type['height']);
             }
         }
     }
     return $ret;
 }