BP_Media_Rotation::attachment_uploaded( $id )
Attachment uploaded and fix rotation
Description
Parameters
- $id
-
(Required)
Source
File: bp-media/classes/class-bp-media-rotation.php
function attachment_uploaded( $id ) {
global $bp_media_rotation_fix_id;
$bp_media_rotation_fix_id = $id;
$attachment = get_post( $id );
$path = get_attached_file( $id );
if ( in_array( $attachment->post_mime_type, array( 'image/jpeg', 'image/png', 'image/gif' ) ) && ! empty( $path ) && file_exists( $path ) ) {
// Add a fallback on shutdown in the case that memory runs out
add_action( 'shutdown', array( $this, 'rotation_shutdown_fallback' ) );
$status = $this->fix_rotation( $path );
if ( ! empty( $status ) ) {
$attachment_meta = wp_generate_attachment_metadata( $id, $path );
wp_update_attachment_metadata( $id, $attachment_meta );
}
}
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.1.1 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.