/**
  * Recover image from backup copy and reprocess it
  *
  * @param int|stdClass|C_Image $image
  * @return string result code
  */
 function recover_image($image)
 {
     if (is_numeric($image)) {
         $image = $this->object->_image_mapper->find($image);
     }
     if (isset($image->meta_data)) {
         $orig_metadata = $image->meta_data;
     }
     $path = $this->object->get_registry()->get_utility('I_Gallery_Storage')->get_image_abspath($image);
     if (!is_object($image)) {
         return __("Could not find image", 'nggallery');
     }
     if (!is_writable($path) && !is_writable(dirname($path))) {
         return ' <strong>' . esc_html($image->filename) . __(' is not writeable', 'nggallery') . '</strong>';
     }
     if (!@file_exists($path . '_backup')) {
         return ' <strong>' . __('Backup file does not exist', 'nggallery') . '</strong>';
     }
     if (!@copy($path . '_backup', $path)) {
         return ' <strong>' . __("Could not restore original image", 'nggallery') . '</strong>';
     }
     if (isset($orig_metadata)) {
         $NextGen_Metadata = new C_NextGen_Metadata($image);
         $new_metadata = $NextGen_Metadata->get_common_meta();
         $image->meta_data = array_merge((array) $orig_metadata, (array) $new_metadata);
         $this->object->_image_mapper->save($image);
     }
     return '1';
 }