wpseek.com
WordPress开发者和主题制作者的搜索引擎
_copy_image_file is private and should not be used in themes or plugins directly.
_copy_image_file › WordPress Function
Since3.4.0
已弃用n/a
› _copy_image_file ( $attachment_id )
访问: |
|
参数: |
|
返回: |
|
定义在: |
|
文档: |
Copies an existing image file.
Related Functions: wp_save_image_file, wp_crop_image, remove_image_size, wp_get_image_mime, has_image_size
源码
function _copy_image_file( $attachment_id ) { $dst_file = get_attached_file( $attachment_id ); $src_file = $dst_file; if ( ! file_exists( $src_file ) ) { $src_file = _load_image_to_edit_path( $attachment_id ); } if ( $src_file ) { $dst_file = str_replace( wp_basename( $dst_file ), 'copy-' . wp_basename( $dst_file ), $dst_file ); $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) ); /* * The directory containing the original file may no longer * exist when using a replication plugin. */ wp_mkdir_p( dirname( $dst_file ) ); if ( ! copy( $src_file, $dst_file ) ) { $dst_file = false; } } else { $dst_file = false; } return $dst_file; }