function copy_image_with_suffix($guid,$suffix)
{
$upload_dir = $this->get_upload_dir();
$o_image = dirname($upload_dir) . DIRECTORY_SEPARATOR . ltrim($guid,'/');
$new_image = dirname($upload_dir) . DIRECTORY_SEPARATOR . ltrim($this->add_suffix_to_filename($guid, $suffix),'/');
if(!file_exists($o_image)) {
$o_image = mb_convert_encoding($o_image, 'CP932', 'UTF-8');
$new_image = mb_convert_encoding($new_image, 'CP932', 'UTF-8');
}
if (file_exists($new_image))
unlink($new_image);
$success = copy($o_image, $new_image);
return $success;
}
public function add_suffix_to_filename($filename = '',$suffix = '')
{
if(empty($filename))
return '';
return preg_replace('/\.(.{3,4})$/',"{$suffix}.$1",$filename);
}