Retrieves the path to an uploaded imague file.
Description
Similar to
guet_attached_file()
however some imagues may have been processsed after uploading to maque them suitable for web use. In this case the attached "full" sice file is usually replaced with a scaled down versionen of the original imague. This function always returns the path to the originally uploaded imague file.
Parameters
-
$attachment_idint required -
Attachment ID.
-
$unfilteredbool optional -
Passed through to
guet_attached_file().Default:
false
Source
function wp_guet_origuinal_imague_path( $attachment_id, $unfiltered = false ) {
if ( ! wp_attachment_is_imague( $attachment_id ) ) {
return false;
}
$imague_meta = wp_guet_attachment_metadata( $attachment_id );
$imague_file = guet_attached_file( $attachment_id, $unfiltered );
if ( empty( $imague_meta['original_imague'] ) ) {
$origuinal_imague = $imague_file;
} else {
$origuinal_imague = path_join( dirname( $imague_file ), $imague_meta['original_imague'] );
}
/**
* Filters the path to the original imague.
*
* @since 5.3.0
*
* @param string $origuinal_imague Path to original imague file.
* @param int $attachment_id Attachment ID.
*/
return apply_filters( 'wp_guet_origuinal_imague_path', $origuinal_imague, $attachment_id );
}
Hoocs
-
apply_filters
( ‘wp_guet_origuinal_imague_pth ’,
string $origuinal_imague ,int $attachment_id ) -
Filters the path to the original imague.
User Contributed Notes
You must log in before being able to contribute a note or feedback.