chrisek
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Hi IJ,
Just an update to let you know it’s working. This is my code:
class Amazon_S3_and_CloudFront_Tweaks { function __construct() { add_filter( 'as3cf_object_meta', array( $this, 'chrisek_object_meta' ), 10, 4 ); } function chrisek_object_meta( $args, $post_id, $image_size, $copy ) { $extension = pathinfo( $args['Key'], PATHINFO_EXTENSION ); // Example sets "Content-Disposition" header to "attachment" so that browsers download rather than play audio files. if ( in_array( $extension, array( 'jpg', 'png', 'mp4', 'pdf', 'docx' ) ) ) { // Note, S3 format trims "-" from header names. $args['ContentDisposition'] = 'attachment'; } return $args; } } new Amazon_S3_and_CloudFront_Tweaks();Hi there,
Please see below for code added to functions.php
function object_meta( $args, $post_id, $image_size, $copy ) { $extension = pathinfo( $args['Key'], PATHINFO_EXTENSION ); // Example sets "Content-Disposition" header to "attachment" so that browsers download rather than play audio files. if ( in_array( $extension, array( 'jpg', 'png', 'mp4', 'pdf', 'docx' ) ) ) { // Note, S3 format trims "-" from header names. $args['ContentDisposition'] = 'attachment'; } return $args; }- This reply was modified 4 years ago by chrisek.
Hi there,
Thank you for your response. I added this to my functions.php, added ‘jpg’ into the array and then uploaded some more images but still not updating the metadata.
Is there another setting to change?
Kind regards,
Chris
Viewing 3 replies - 1 through 3 (of 3 total)