WordPress at a glance
function is not described

WP_Image_Editor::generate_filename() public WP 3.5.0

Builds an output filename based on current file, and adding proper suffix

{} It's a method of the class: WP_Image_Editor{}

No Hooks.

Return

String. filename

Usage

$WP_Image_Editor = new WP_Image_Editor();
$WP_Image_Editor->generate_filename( $suffix, $dest_path, $extension );
$suffix(string)

Default: null
$dest_path(string)

Default: null
$extension(string)

Default: null

Changelog

Since 3.5.0 Introduced.

Code of WP_Image_Editor::generate_filename() WP 5.5.2

<?php
public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) {
	// $suffix will be appended to the destination filename, just before the extension.
	if ( ! $suffix ) {
		$suffix = $this->get_suffix();
	}

	$dir = pathinfo( $this->file, PATHINFO_DIRNAME );
	$ext = pathinfo( $this->file, PATHINFO_EXTENSION );

	$name    = wp_basename( $this->file, ".$ext" );
	$new_ext = strtolower( $extension ? $extension : $ext );

	if ( ! is_null( $dest_path ) ) {
		$_dest_path = realpath( $dest_path );
		if ( $_dest_path ) {
			$dir = $_dest_path;
		}
	}

	return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}";
}