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: ''


Top ↑

Return Return

(false|string) $value The absolute path to the new file name.


Top ↑

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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.