PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.4.2
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.4.2
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / inc / functions / attachments.php

attachments.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 1.4.2, at inc/functions/attachments.php

46 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
3
4 /*
5 * Get all mime type which could be optimized by Imagify.
6 *
7 * @since 1.3
8 *
9 * @return array $mime_type The mime type.
10 */
11 function get_imagify_mime_type() {
12 $mime_type = array(
13 'image/jpeg',
14 'image/png',
15 'image/gif'
16 );
17
18 return $mime_type;
19 }
20
21 /*
22 * Get the backup path of a specific attachement.
23 *
24 * @since 1.0
25 *
26 * @param int $file_path The attachment path.
27 * @return string $backup_path The backup path.
28 */
29 function get_imagify_attachment_backup_path( $file_path ) {
30 $upload_dir = wp_upload_dir();
31 $upload_basedir = trailingslashit( $upload_dir['basedir'] );
32 $backup_dir = $upload_basedir . 'backup/';
33
34 /**
35 * Filter the backup directory path
36 *
37 * @since 1.0
38 *
39 * @param string $backup_dir The backup directory path
40 */
41 $backup_dir = apply_filters( 'imagify_backup_directory', $backup_dir );
42 $backup_dir = trailingslashit( $backup_dir );
43
44 $backup_path = str_replace( $upload_basedir, $backup_dir, $file_path );
45 return $backup_path;
46 }