Plugin Directory

Changeset 3439319


Ignore:
Timestamp:
01/14/2026 09:22:33 AM (2 weeks ago)
Author:
kubiq
Message:

1.1

  • optimize old images convert process
  • remove not working images_to_avif_extensions filter
Location:
images-to-avif/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • images-to-avif/trunk/images-to-avif.php

    r3438659 r3439319  
    44    Plugin URI: https://www.paypal.me/jakubnovaksl
    55    Description: Convert JPG, PNG, GIF and WEBP images to AVIF and speed up your web
    6     Version: 1.0
     6    Version: 1.1
    77    Author: KubiQ
    88    Author URI: https://kubiq.sk
     
    292292                            $files = scandir( $folder );
    293293                            $converted = 0;
     294
     295                            $skip_until = false;
     296                            $avif_processed_file = $folder . '/.avif-processed.json';
     297                            if( file_exists( $avif_processed_file ) ){
     298                                $skip_until = trim( file_get_contents( $avif_processed_file ) );
     299                            }
     300
    294301                            foreach( $files as $file ){
    295302                                if( ! $only_missing || ! file_exists( $folder . '/' . $file . '.avif' ) ){
    296                                     if( substr( $file, -5 ) != '.webp' || ! file_exists( substr( $folder . '/' . $file, 0, -5 ) ) ){
    297                                         $converted += $this->convert_image( $folder . '/' . $file ) ? 1 : 0;
     303                                    if( substr( $file, -5 ) != '.avif' ){
     304                                        if( substr( $file, -5 ) != '.webp' || ! file_exists( substr( $folder . '/' . $file, 0, -5 ) ) ){
     305                                            if( $skip_until ){
     306                                                if( $skip_until == $folder . '/' . $file ){
     307                                                    $skip_until = false;
     308                                                }
     309                                            }else{
     310                                                $converted += $this->convert_image( $folder . '/' . $file ) ? 1 : 0;
     311                                                file_put_contents( $avif_processed_file, $folder . '/' . $file, LOCK_EX );
     312                                            }
     313                                        }
    298314                                    }
    299315                                }
    300316                            }
     317
     318                            wp_delete_file( $avif_processed_file );
     319
    301320                            /* translators: amount of converted files */
    302321                            printf( esc_html__( '%d converted', 'images-to-avif' ), intval( $converted ) );
  • images-to-avif/trunk/readme.txt

    r3438659 r3439319  
    66Requires PHP: 7.0
    77Tested up to: 6.9
    8 Stable tag: 1.0
     8Stable tag: 1.1
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333
    3434## Hooks for developers
    35 
    36 #### images_to_avif_extensions
    37 Maybe you want to support also less famous JPEG extension like jpe, jfif or jif
    38 
    39 `add_filter( 'images_to_avif_extensions', 'extra_images_to_avif_extensions', 10, 1 );
    40 function extra_images_to_avif_extensions( $extensions ){
    41     $extensions[] = 'jpe';
    42     $extensions[] = 'jfif';
    43     $extensions[] = 'jif';
    44     return $extensions;
    45 }`
    4635
    4736#### images_to_avif_sizes
     
    179168== Changelog ==
    180169
     170= 1.1 =
     171* optimize old images convert process
     172* remove not working images_to_avif_extensions filter
     173
    181174= 1.0 =
    182175* First version
  • images-to-avif/trunk/tabs/tab-general.php

    r3438659 r3439319  
    112112            </th>
    113113            <td>
    114                 <?php $this->extensions = apply_filters( 'images_to_avif_extensions', $this->extensions ); ?>
    115114                <?php foreach( $this->extensions as $images_to_avif_extension ): ?>
    116115                    <br>
Note: See TracChangeset for help on using the changeset viewer.