wp-content/plugins/resmushit-image-optimizer/classes/resmushit.class.php
/**
	 *
	 * Revert original file and regenerates attachment thumbnails
	 *
	 * @param  int 		$attachment_id 	ID of the attachment to revert
	 * @return none
	 */
Revert original file and regenerates attachment thumbnails
@param  int          $attachment_id  ID of the attachment to revert
@return none
Revert original file and regenerates attachment thumbnails @param int $attachment_id ID of the attachment to revert @return none
public static function revert($id) {
		global $wp_version;
		global $attachment_id;
		$attachment_id = $id;
		delete_post_meta($attachment_id, 'resmushed_quality');
		delete_post_meta($attachment_id, 'resmushed_cumulated_original_sizes');
		delete_post_meta($attachment_id, 'resmushed_cumulated_optimized_sizes');	
		$basepath = dirname(get_attached_file( $attachment_id )) . '/';
		$fileInfo = pathinfo(get_attached_file( $attachment_id ));
		$originalFile = $basepath . $fileInfo['filename'] . '-unsmushed.' . $fileInfo['extension'];
		rlog('Revert original image for : ' . get_attached_file( $attachment_id ));
		if(file_exists($originalFile))
			copy($originalFile, get_attached_file( $attachment_id ));
		wp_generate_attachment_metadata($attachment_id, get_attached_file( $attachment_id ));
		return self::wasSuccessfullyUpdated( $attachment_id );
	}
public static function revert ( $ id ) { global $ wp_version ; global $ attachment_id ; $ attachment_id = $ id ; delete_post_meta ( $ attachment_id , 'resmushed_quality' ) ; delete_post_meta ( $ attachment_id , 'resmushed_cumulated_original_sizes' ) ; delete_post_meta ( $ attachment_id , 'resmushed_cumulated_optimized_sizes' ) ; $ basepath = dirname ( get_attached_file ( $ attachment_id ) ) . '/' ; $ fileInfo = pathinfo ( get_attached_file ( $ attachment_id ) ) ; $ originalFile = $ basepath . $ fileInfo [ 'filename' ] . '-unsmushed.' . $ fileInfo [ 'extension' ] ; rlog ( 'Revert original image for : ' . get_attached_file ( $ attachment_id ) ) ; if ( file_exists ( $ originalFile ) ) copy ( $ originalFile , get_attached_file ( $ attachment_id ) ) ; wp_generate_attachment_metadata ( $ attachment_id , get_attached_file ( $ attachment_id ) ) ; return self :: wasSuccessfullyUpdated ( $ attachment_id ) ; }
Revert original file and regenerates attachment thumbnails
 @param  int          $attachment_id  ID of the attachment to revert
 @return none
Revert original file and regenerates attachment thumbnails @param int $attachment_id ID of the attachment to revert @return none
//Regenerate thumbnails