BP_Attachment_Cover_Image::generate_filename( string $file = '' )
Generate a filename for the cover image.
Description Description
Parameters Parameters
- $file
-
(Optional) The absolute path to the file.
Default value: ''
Return Return
(false|string) $value The absolute path to the new file name.
Source Source
File: bp-core/classes/class-bp-attachment-cover-image.php
public function generate_filename( $file = '' ) { if ( empty( $file ) || ! file_exists( $file ) ) { return false; } $info = pathinfo( $file ); $ext = strtolower( $info['extension'] ); $name = wp_unique_filename( $info['dirname'], uniqid() . "-bp-cover-image.$ext" ); return trailingslashit( $info['dirname'] ) . $name; }
Changelog Changelog
Version | Description |
---|---|
2.4.0 | Introduced. |