Plugin Directory

Changeset 3296862


Ignore:
Timestamp:
05/19/2025 10:16:43 PM (10 months ago)
Author:
dbeja
Message:

Update to version 1.1.2 from GitHub

Location:
alt-text-imagerr-ai
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • alt-text-imagerr-ai/tags/1.1.2/assets/imagerr-attachment.js

    r3249550 r3296862  
    11jQuery(document).ready(function($) {
     2    const isAttachmentPost = window.location.href.includes('post.php') && $('body').hasClass('post-type-attachment');
     3    const isUploadPage = window.location.href.includes('upload.php');
     4
    25    function generateMetaButtonHtml(attachmentId) {
    3         return '<div id="imagerr-generate-metadata-wrapper" class="setting description"><button class="button-primary imagerr-generate-metadata" data-id="' + attachmentId + '">' + imagerr_vars.i18n.update_with_imagerr + '</button><div class="imagerr-error" style="display: none; color: red;"></div></div>';
     6        return '<div id="imagerr-generate-metadata-wrapper" class="setting description"><button class="button-primary imagerr-generate-metadata" data-id="' + attachmentId + '">' + imagerr_vars.i18n.update_with_imagerr + '</button><div class="imagerr-error" style="display: none; color: red;"></div><div class="imagerr-success" style="display: none; color: green;">' + imagerr_vars.i18n.image_updated + '</div></div>';
    47    }
    58
    6     var counter = 0;
    7     var interval = setInterval(function() {
    8         counter++;
    9         if (counter > 20) {
    10             clearInterval(interval);
    11             return;
    12         }
    13         if ($('#imagerr-generate-metadata-wrapper').length > 0) {
    14             clearInterval(interval);
    15             return;
    16         }
    17         if ($('.attachment-info').length > 0) {
    18             clearInterval(interval);
    19             var attachment_id = imagerr_vars.item_id;
     9    if (isAttachmentPost) {
     10        var attachment_id = imagerr_vars.item_id;
     11        $('.attachment-alt-text').after(generateMetaButtonHtml(attachment_id));
     12    } else if (isUploadPage) {
     13        var counter = 0;
     14        var interval = setInterval(function() {
     15            counter++;
     16            if (counter > 20) {
     17                clearInterval(interval);
     18                return;
     19            }
     20            if ($('#imagerr-generate-metadata-wrapper').length > 0) {
     21                clearInterval(interval);
     22                return;
     23            }
     24            if ($('.attachment-info').length > 0) {
     25                clearInterval(interval);
     26                var attachment_id = imagerr_vars.item_id;
     27                $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachment_id));
     28            }
     29        }, 500);
     30
     31        $(document).on('click', 'li.attachment', function() {
     32            var attachment_id = $(this).attr('data-id');
     33            $('#imagerr-generate-metadata-wrapper').remove();
    2034            $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachment_id));
    21         }
    22     }, 500);
    23 
    24     $(document).on('click', 'li.attachment', function() {
    25         var attachment_id = $(this).attr('data-id');
    26         $('#imagerr-generate-metadata-wrapper').remove();
    27         $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachment_id));
    28     });
     35        });
     36   
     37        $(document).on('click', function(e) {
     38            if( !e.target.matches('.media-modal .right, .media-modal .left') ) {
     39                return;
     40            }
     41            setTimeout(function() {
     42                if ($('#imagerr-generate-metadata-wrapper').length > 0) {
     43                    return;
     44                }
     45                const urlParams = new URLSearchParams(window.location.search);
     46                const attachmentId = urlParams.get('item');
     47                $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachmentId));
     48            }, 100);
     49        });
     50    }
    2951
    3052    $(document).on('click', '.imagerr-generate-metadata', function() {
     
    4365            success: function(response) {
    4466                // Update the meta fields
    45                 var attachment_wrapper = $this.closest('.attachment-info');
    46                 $('[data-setting="alt"] textarea', attachment_wrapper).val(response.alt_text);
    47                 $('[data-setting="title"] input[type="text"]', attachment_wrapper).val(response.title);
    48                 $('[data-setting="caption"] textarea', attachment_wrapper).val(response.caption);
    49                 $('[data-setting="description"] textarea', attachment_wrapper).val(response.description);
     67                if (isAttachmentPost) {
     68                    window.location.reload();
     69                } else {
     70                    var attachment_wrapper = $this.closest('.attachment-info');
     71                    $('[data-setting="alt"] textarea', attachment_wrapper).val(response.alt_text);
     72                    $('[data-setting="title"] input[type="text"]', attachment_wrapper).val(response.title);
     73                    $('[data-setting="caption"] textarea', attachment_wrapper).val(response.caption);
     74                    $('[data-setting="description"] textarea', attachment_wrapper).val(response.description);   
     75                }
     76
     77                $this.closest('.imagerr-generate-metadata-wrapper').find('.imagerr-success').show().html(imagerr_vars.i18n.image_updated);
     78                setTimeout(function() {
     79                    $this.closest('.imagerr-generate-metadata-wrapper').find('.imagerr-success').hide();
     80                }, 3000);
    5081
    5182                $this.prop('disabled', false).html(imagerr_vars.i18n.update_with_imagerr);
     
    5485                // Enable button and show error message
    5586                $this.prop('disabled', false).html(imagerr_vars.i18n.update_with_imagerr);
    56                 $('.imagerr-error').show().html(error.responseJSON);
     87                $this.closest('.imagerr-generate-metadata-wrapper').find('.imagerr-error').show().html(error.responseJSON);
    5788            }
    5889        });
  • alt-text-imagerr-ai/tags/1.1.2/imagerr.php

    r3279851 r3296862  
    11<?php
    22/**
    3  * Plugin Name: Alt Text Imagerr AI
    4  * Description: Generates alt text, titles, descriptions, and captions for your images automatically with AI. Improve your accessibility & SEO.
    5  * Version: 1.1.1
     3 * Plugin Name: AI Image Alt Text Generator for WordPress – Imagerr AI
     4 * Description: Generate alt text, titles, descriptions, and captions for your images automatically with AI
     5 * Version: 1.1.2
    66 * Text Domain: alt-text-imagerr-ai
    77 * Domain Path: /languages
     
    2727
    2828// PHP Constant for plugin version.
    29 define( 'IMAGERR_VERSION', '1.1.1' );
     29define( 'IMAGERR_VERSION', '1.1.2' );
    3030
    3131// Delete dismissed notice option on plugin activation
     
    7373        add_action('admin_notices', array( $this, 'admin_notice' ) );
    7474        add_action('wp_ajax_imagerr_dismiss_notice', array( $this, 'dismiss_notice' ) );
     75        add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
    7576        // Add action to generate metadata on upload.
    7677        if ( get_option( 'imagerr_auto_generate_on_upload' ) ) {
     
    7879            add_filter( 'wp_generate_attachment_metadata', array( $this, 'generate_meta_after_upload' ), 10, 2 );
    7980        }
     81
     82        // Add Imagerr column to media library
     83        add_filter( 'manage_media_columns', array( $this, 'add_imagerr_column' ) );
     84        add_action( 'manage_media_custom_column', array( $this, 'add_imagerr_column_content' ), 10, 2 );
    8085    }
    8186
     
    8691        $this->meta_async      = new MetaAsync();
    8792        $this->meta_bulk_async = new MetaBulkAsync();
     93    }
     94
     95    /**
     96     * Load plugin text domain
     97     */
     98    public function load_plugin_textdomain() {
     99        load_plugin_textdomain(
     100            'alt-text-imagerr-ai',
     101            false,
     102            dirname( plugin_basename( __FILE__ ) ) . '/languages/'
     103        );
    88104    }
    89105
     
    279295                        'status_generating'   => esc_html__( '🏃‍♂️‍➡️ Generating...', 'alt-text-imagerr-ai' ),
    280296                        'status_stopping_generation' => esc_html__( '🚫 Stopping generation...', 'alt-text-imagerr-ai' ),
     297                        'image_updated' => esc_html__( '✅ Image updated', 'alt-text-imagerr-ai' ),
    281298                    ),
    282299                )
     
    285302
    286303        // Attachment page.
    287         if ( 'upload.php' === $hook ) {
     304        if ( 'upload.php' === $hook || 'post.php' === $hook ) {
    288305            wp_enqueue_script( 'imagerr-attachment-script', plugin_dir_url( __FILE__ ) . 'assets/imagerr-attachment.js', array( 'jquery' ), IMAGERR_VERSION, true );
    289306
     
    291308            if ( isset( $_GET['item'] ) ) {
    292309                $item_id = absint( $_GET['item'] );
     310            }
     311
     312            if ( isset( $_GET['post'] ) ) {
     313                $item_id = absint( $_GET['post'] );
    293314            }
    294315
     
    717738        return $metadata;
    718739    }
     740
     741    /**
     742     * Add Imagerr column to media library
     743     *
     744     * @param array $columns Array of columns.
     745     * @return array Modified array of columns.
     746     */
     747    public function add_imagerr_column( $columns ) {
     748        $columns['imagerr'] = __( 'Imagerr', 'alt-text-imagerr-ai' );
     749        return $columns;
     750    }
     751
     752    /**
     753     * Add content to Imagerr column
     754     *
     755     * @param string $column_name Name of the column.
     756     * @param int    $post_id     Post ID.
     757     */
     758    public function add_imagerr_column_content( $column_name, $post_id ) {
     759        if ( 'imagerr' !== $column_name ) {
     760            return;
     761        }
     762
     763        // Only show for images
     764        if ( ! wp_attachment_is_image( $post_id ) ) {
     765            return;
     766        }
     767
     768        // Add the button HTML
     769        ?>
     770        <div class="imagerr-generate-metadata-wrapper">
     771            <button class="button-primary imagerr-generate-metadata" data-id="<?php echo esc_attr( $post_id ); ?>">
     772                <?php esc_html_e( 'Update with Imagerr', 'alt-text-imagerr-ai' ); ?>
     773            </button>
     774            <div class="imagerr-error" style="display: none; color: red;"></div>
     775            <div class="imagerr-success" style="display: none; color: green;">
     776                <?php esc_html_e( '✅ Image updated', 'alt-text-imagerr-ai' ); ?>
     777            </div>
     778        </div>
     779        <?php
     780    }
    719781}
    720782
  • alt-text-imagerr-ai/tags/1.1.2/languages/alt-text-imagerr-ai-en_US.po

    r3271433 r3296862  
    33msgstr ""
    44"Project-Id-Version: Alt Text Imagerr AI\n"
    5 "POT-Creation-Date: 2025-04-10 15:55+0100\n"
    6 "PO-Revision-Date: 2025-04-10 15:56+0100\n"
     5"POT-Creation-Date: 2025-05-19 18:02+0100\n"
     6"PO-Revision-Date: 2025-05-19 18:03+0100\n"
    77"Last-Translator: \n"
    88"Language-Team: \n"
     
    2222"X-Poedit-SearchPathExcluded-0: *.min.js\n"
    2323
    24 #: imagerr.php:95 imagerr.php:96
     24#: imagerr.php:99 imagerr.php:100
    2525msgid "Imagerr AI"
    2626msgstr ""
    2727
    28 #: imagerr.php:106 imagerr.php:107
     28#: imagerr.php:110 imagerr.php:111
    2929msgid "Settings"
    3030msgstr ""
    3131
    32 #: imagerr.php:115 imagerr.php:116 templates/generate.php:6
     32#: imagerr.php:119 imagerr.php:120 templates/generate.php:6
    3333msgid "Bulk Generator"
    3434msgstr ""
    3535
    36 #: imagerr.php:135
     36#: imagerr.php:139
    3737msgid ""
    3838"Imagerr AI plugin has been installed. To claim your free trial register on"
    3939msgstr ""
    4040
    41 #: imagerr.php:137
     41#: imagerr.php:141
    4242msgid "You can also check the"
    4343msgstr ""
    4444
    45 #: imagerr.php:138
     45#: imagerr.php:142
    4646msgid "plugin documentation"
    4747msgstr ""
    4848
    49 #: imagerr.php:275 templates/generate.php:31
     49#: imagerr.php:280 templates/generate.php:31
    5050msgid "Update Meta"
    5151msgstr ""
    5252
    53 #: imagerr.php:276
     53#: imagerr.php:281
    5454msgid "✅ Completed"
    5555msgstr ""
    5656
    57 #: imagerr.php:277
     57#: imagerr.php:282
    5858msgid "Generating metadata..."
    5959msgstr ""
    6060
    61 #: imagerr.php:278 templates/generate.php:22
     61#: imagerr.php:283 templates/generate.php:22
    6262msgid "🏃‍♂️‍➡️ Generating..."
    6363msgstr ""
    6464
    65 #: imagerr.php:279
     65#: imagerr.php:284
    6666msgid "🚫 Stopping generation..."
    6767msgstr ""
    6868
    69 #: imagerr.php:304
     69#: imagerr.php:285 imagerr.php:764
     70msgid "✅ Image updated"
     71msgstr ""
     72
     73#: imagerr.php:313 imagerr.php:760
    7074msgid "Update with Imagerr"
    7175msgstr ""
    7276
    73 #: imagerr.php:305
     77#: imagerr.php:314
    7478msgid "Generating..."
    7579msgstr ""
    7680
    7781#. translators: %s: URL to Imagerr account page
    78 #: imagerr.php:375 imagerr.php:418
     82#: imagerr.php:426 imagerr.php:469
    7983#, php-format
    8084msgid ""
     
    8387msgstr ""
    8488
    85 #: imagerr.php:384 imagerr.php:427
     89#: imagerr.php:435 imagerr.php:478
    8690msgid ""
    8791"Sorry, you do not have enough credits to generate metadata. Please add more "
     
    8993msgstr ""
    9094
    91 #: imagerr.php:499
     95#: imagerr.php:550
    9296msgid "Bulk metadata generation started"
    9397msgstr ""
    9498
    95 #: imagerr.php:524
     99#: imagerr.php:575
    96100msgid "Stopping generation..."
     101msgstr ""
     102
     103#: imagerr.php:736
     104msgid "Imagerr"
    97105msgstr ""
    98106
     
    135143msgstr ""
    136144
     145#: templates/generate.php:45
     146msgid "Images not processed"
     147msgstr ""
     148
     149#: templates/generate.php:50
     150msgid "Image ID"
     151msgstr ""
     152
     153#: templates/generate.php:51
     154msgid "Error Message"
     155msgstr ""
     156
    137157#: templates/settings.php:12
    138158msgid "Imagerr Settings"
     
    206226
    207227#. Plugin Name of the plugin/theme
    208 msgid "Alt Text Imagerr AI"
     228msgid "AI Image Alt Text Generator for WordPress – Imagerr AI"
    209229msgstr ""
    210230
    211231#. Description of the plugin/theme
    212232msgid ""
    213 "Generates alt text, titles, descriptions, and captions for your images "
    214 "automatically with AI. Improve your accessibility & SEO."
     233"Generate alt text, titles, descriptions, and captions for your images "
     234"automatically with AI"
    215235msgstr ""
    216236
  • alt-text-imagerr-ai/tags/1.1.2/languages/alt-text-imagerr-ai.pot

    r3271433 r3296862  
    33msgstr ""
    44"Project-Id-Version: Alt Text Imagerr AI\n"
    5 "POT-Creation-Date: 2025-04-10 15:55+0100\n"
     5"POT-Creation-Date: 2025-05-19 18:02+0100\n"
    66"PO-Revision-Date: 2025-02-22 09:33+0000\n"
    77"Last-Translator: \n"
     
    2222"X-Poedit-SearchPathExcluded-0: *.min.js\n"
    2323
    24 #: imagerr.php:95 imagerr.php:96
     24#: imagerr.php:99 imagerr.php:100
    2525msgid "Imagerr AI"
    2626msgstr ""
    2727
    28 #: imagerr.php:106 imagerr.php:107
     28#: imagerr.php:110 imagerr.php:111
    2929msgid "Settings"
    3030msgstr ""
    3131
    32 #: imagerr.php:115 imagerr.php:116 templates/generate.php:6
     32#: imagerr.php:119 imagerr.php:120 templates/generate.php:6
    3333msgid "Bulk Generator"
    3434msgstr ""
    3535
    36 #: imagerr.php:135
     36#: imagerr.php:139
    3737msgid ""
    3838"Imagerr AI plugin has been installed. To claim your free trial register on"
    3939msgstr ""
    4040
    41 #: imagerr.php:137
     41#: imagerr.php:141
    4242msgid "You can also check the"
    4343msgstr ""
    4444
    45 #: imagerr.php:138
     45#: imagerr.php:142
    4646msgid "plugin documentation"
    4747msgstr ""
    4848
    49 #: imagerr.php:275 templates/generate.php:31
     49#: imagerr.php:280 templates/generate.php:31
    5050msgid "Update Meta"
    5151msgstr ""
    5252
    53 #: imagerr.php:276
     53#: imagerr.php:281
    5454msgid "✅ Completed"
    5555msgstr ""
    5656
    57 #: imagerr.php:277
     57#: imagerr.php:282
    5858msgid "Generating metadata..."
    5959msgstr ""
    6060
    61 #: imagerr.php:278 templates/generate.php:22
     61#: imagerr.php:283 templates/generate.php:22
    6262msgid "🏃‍♂️‍➡️ Generating..."
    6363msgstr ""
    6464
    65 #: imagerr.php:279
     65#: imagerr.php:284
    6666msgid "🚫 Stopping generation..."
    6767msgstr ""
    6868
    69 #: imagerr.php:304
     69#: imagerr.php:285 imagerr.php:764
     70msgid "✅ Image updated"
     71msgstr ""
     72
     73#: imagerr.php:313 imagerr.php:760
    7074msgid "Update with Imagerr"
    7175msgstr ""
    7276
    73 #: imagerr.php:305
     77#: imagerr.php:314
    7478msgid "Generating..."
    7579msgstr ""
    7680
    7781#. translators: %s: URL to Imagerr account page
    78 #: imagerr.php:375 imagerr.php:418
     82#: imagerr.php:426 imagerr.php:469
    7983#, php-format
    8084msgid ""
     
    8387msgstr ""
    8488
    85 #: imagerr.php:384 imagerr.php:427
     89#: imagerr.php:435 imagerr.php:478
    8690msgid ""
    8791"Sorry, you do not have enough credits to generate metadata. Please add more "
     
    8993msgstr ""
    9094
    91 #: imagerr.php:499
     95#: imagerr.php:550
    9296msgid "Bulk metadata generation started"
    9397msgstr ""
    9498
    95 #: imagerr.php:524
     99#: imagerr.php:575
    96100msgid "Stopping generation..."
     101msgstr ""
     102
     103#: imagerr.php:736
     104msgid "Imagerr"
    97105msgstr ""
    98106
     
    135143msgstr ""
    136144
     145#: templates/generate.php:45
     146msgid "Images not processed"
     147msgstr ""
     148
     149#: templates/generate.php:50
     150msgid "Image ID"
     151msgstr ""
     152
     153#: templates/generate.php:51
     154msgid "Error Message"
     155msgstr ""
     156
    137157#: templates/settings.php:12
    138158msgid "Imagerr Settings"
     
    206226
    207227#. Plugin Name of the plugin/theme
    208 msgid "Alt Text Imagerr AI"
     228msgid "AI Image Alt Text Generator for WordPress – Imagerr AI"
    209229msgstr ""
    210230
    211231#. Description of the plugin/theme
    212232msgid ""
    213 "Generates alt text, titles, descriptions, and captions for your images "
    214 "automatically with AI. Improve your accessibility & SEO."
     233"Generate alt text, titles, descriptions, and captions for your images "
     234"automatically with AI"
    215235msgstr ""
    216236
  • alt-text-imagerr-ai/tags/1.1.2/readme.txt

    r3279851 r3296862  
    1 === AI Image Alt Text Generator - Imagerr AI ===
     1=== AI Image Alt Text Generator for WordPress – Imagerr AI ===
    22Contributors: andrejdivi, dbeja
    33Donate link: https://www.paypal.com/paypalme/dbkode
    44Tags: ai, image, alt, text, generator
    55Requires PHP: 5.2
    6 Requires at least: 3.0
    7 Stable tag: 1.1.1
     6Requires at least: 4.6
     7Stable tag: 1.1.2
    88Tested up to: 6.8
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Generate alt text, titles, descriptions, and captions for your images automatically with AI — now with full post content updates and support for Divi & Elementor.
     12Generate alt text, titles, descriptions, and captions for your images automatically with AI
    1313
    1414== Description ==
     
    6969== Changelog ==
    7070
     71= 1.1.2 =
     72* Fixed issue where the "Update with Imagerr" button didn't work after navigating between images in the media modal
     73* Added "Update with Imagerr" button to the Edit Attachment page for easier access
     74* Added "Update with Imagerr" button to the Media Library list view (images table)
     75* Minor UI tweaks and performance improvements
     76
    7177= 1.1.1 =
    7278* Improved bulk generation process with automatic retries for failed images
  • alt-text-imagerr-ai/trunk/assets/imagerr-attachment.js

    r3249550 r3296862  
    11jQuery(document).ready(function($) {
     2    const isAttachmentPost = window.location.href.includes('post.php') && $('body').hasClass('post-type-attachment');
     3    const isUploadPage = window.location.href.includes('upload.php');
     4
    25    function generateMetaButtonHtml(attachmentId) {
    3         return '<div id="imagerr-generate-metadata-wrapper" class="setting description"><button class="button-primary imagerr-generate-metadata" data-id="' + attachmentId + '">' + imagerr_vars.i18n.update_with_imagerr + '</button><div class="imagerr-error" style="display: none; color: red;"></div></div>';
     6        return '<div id="imagerr-generate-metadata-wrapper" class="setting description"><button class="button-primary imagerr-generate-metadata" data-id="' + attachmentId + '">' + imagerr_vars.i18n.update_with_imagerr + '</button><div class="imagerr-error" style="display: none; color: red;"></div><div class="imagerr-success" style="display: none; color: green;">' + imagerr_vars.i18n.image_updated + '</div></div>';
    47    }
    58
    6     var counter = 0;
    7     var interval = setInterval(function() {
    8         counter++;
    9         if (counter > 20) {
    10             clearInterval(interval);
    11             return;
    12         }
    13         if ($('#imagerr-generate-metadata-wrapper').length > 0) {
    14             clearInterval(interval);
    15             return;
    16         }
    17         if ($('.attachment-info').length > 0) {
    18             clearInterval(interval);
    19             var attachment_id = imagerr_vars.item_id;
     9    if (isAttachmentPost) {
     10        var attachment_id = imagerr_vars.item_id;
     11        $('.attachment-alt-text').after(generateMetaButtonHtml(attachment_id));
     12    } else if (isUploadPage) {
     13        var counter = 0;
     14        var interval = setInterval(function() {
     15            counter++;
     16            if (counter > 20) {
     17                clearInterval(interval);
     18                return;
     19            }
     20            if ($('#imagerr-generate-metadata-wrapper').length > 0) {
     21                clearInterval(interval);
     22                return;
     23            }
     24            if ($('.attachment-info').length > 0) {
     25                clearInterval(interval);
     26                var attachment_id = imagerr_vars.item_id;
     27                $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachment_id));
     28            }
     29        }, 500);
     30
     31        $(document).on('click', 'li.attachment', function() {
     32            var attachment_id = $(this).attr('data-id');
     33            $('#imagerr-generate-metadata-wrapper').remove();
    2034            $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachment_id));
    21         }
    22     }, 500);
    23 
    24     $(document).on('click', 'li.attachment', function() {
    25         var attachment_id = $(this).attr('data-id');
    26         $('#imagerr-generate-metadata-wrapper').remove();
    27         $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachment_id));
    28     });
     35        });
     36   
     37        $(document).on('click', function(e) {
     38            if( !e.target.matches('.media-modal .right, .media-modal .left') ) {
     39                return;
     40            }
     41            setTimeout(function() {
     42                if ($('#imagerr-generate-metadata-wrapper').length > 0) {
     43                    return;
     44                }
     45                const urlParams = new URLSearchParams(window.location.search);
     46                const attachmentId = urlParams.get('item');
     47                $('.attachment-info .setting.alt-text').after(generateMetaButtonHtml(attachmentId));
     48            }, 100);
     49        });
     50    }
    2951
    3052    $(document).on('click', '.imagerr-generate-metadata', function() {
     
    4365            success: function(response) {
    4466                // Update the meta fields
    45                 var attachment_wrapper = $this.closest('.attachment-info');
    46                 $('[data-setting="alt"] textarea', attachment_wrapper).val(response.alt_text);
    47                 $('[data-setting="title"] input[type="text"]', attachment_wrapper).val(response.title);
    48                 $('[data-setting="caption"] textarea', attachment_wrapper).val(response.caption);
    49                 $('[data-setting="description"] textarea', attachment_wrapper).val(response.description);
     67                if (isAttachmentPost) {
     68                    window.location.reload();
     69                } else {
     70                    var attachment_wrapper = $this.closest('.attachment-info');
     71                    $('[data-setting="alt"] textarea', attachment_wrapper).val(response.alt_text);
     72                    $('[data-setting="title"] input[type="text"]', attachment_wrapper).val(response.title);
     73                    $('[data-setting="caption"] textarea', attachment_wrapper).val(response.caption);
     74                    $('[data-setting="description"] textarea', attachment_wrapper).val(response.description);   
     75                }
     76
     77                $this.closest('.imagerr-generate-metadata-wrapper').find('.imagerr-success').show().html(imagerr_vars.i18n.image_updated);
     78                setTimeout(function() {
     79                    $this.closest('.imagerr-generate-metadata-wrapper').find('.imagerr-success').hide();
     80                }, 3000);
    5081
    5182                $this.prop('disabled', false).html(imagerr_vars.i18n.update_with_imagerr);
     
    5485                // Enable button and show error message
    5586                $this.prop('disabled', false).html(imagerr_vars.i18n.update_with_imagerr);
    56                 $('.imagerr-error').show().html(error.responseJSON);
     87                $this.closest('.imagerr-generate-metadata-wrapper').find('.imagerr-error').show().html(error.responseJSON);
    5788            }
    5889        });
  • alt-text-imagerr-ai/trunk/imagerr.php

    r3279851 r3296862  
    11<?php
    22/**
    3  * Plugin Name: Alt Text Imagerr AI
    4  * Description: Generates alt text, titles, descriptions, and captions for your images automatically with AI. Improve your accessibility & SEO.
    5  * Version: 1.1.1
     3 * Plugin Name: AI Image Alt Text Generator for WordPress – Imagerr AI
     4 * Description: Generate alt text, titles, descriptions, and captions for your images automatically with AI
     5 * Version: 1.1.2
    66 * Text Domain: alt-text-imagerr-ai
    77 * Domain Path: /languages
     
    2727
    2828// PHP Constant for plugin version.
    29 define( 'IMAGERR_VERSION', '1.1.1' );
     29define( 'IMAGERR_VERSION', '1.1.2' );
    3030
    3131// Delete dismissed notice option on plugin activation
     
    7373        add_action('admin_notices', array( $this, 'admin_notice' ) );
    7474        add_action('wp_ajax_imagerr_dismiss_notice', array( $this, 'dismiss_notice' ) );
     75        add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
    7576        // Add action to generate metadata on upload.
    7677        if ( get_option( 'imagerr_auto_generate_on_upload' ) ) {
     
    7879            add_filter( 'wp_generate_attachment_metadata', array( $this, 'generate_meta_after_upload' ), 10, 2 );
    7980        }
     81
     82        // Add Imagerr column to media library
     83        add_filter( 'manage_media_columns', array( $this, 'add_imagerr_column' ) );
     84        add_action( 'manage_media_custom_column', array( $this, 'add_imagerr_column_content' ), 10, 2 );
    8085    }
    8186
     
    8691        $this->meta_async      = new MetaAsync();
    8792        $this->meta_bulk_async = new MetaBulkAsync();
     93    }
     94
     95    /**
     96     * Load plugin text domain
     97     */
     98    public function load_plugin_textdomain() {
     99        load_plugin_textdomain(
     100            'alt-text-imagerr-ai',
     101            false,
     102            dirname( plugin_basename( __FILE__ ) ) . '/languages/'
     103        );
    88104    }
    89105
     
    279295                        'status_generating'   => esc_html__( '🏃‍♂️‍➡️ Generating...', 'alt-text-imagerr-ai' ),
    280296                        'status_stopping_generation' => esc_html__( '🚫 Stopping generation...', 'alt-text-imagerr-ai' ),
     297                        'image_updated' => esc_html__( '✅ Image updated', 'alt-text-imagerr-ai' ),
    281298                    ),
    282299                )
     
    285302
    286303        // Attachment page.
    287         if ( 'upload.php' === $hook ) {
     304        if ( 'upload.php' === $hook || 'post.php' === $hook ) {
    288305            wp_enqueue_script( 'imagerr-attachment-script', plugin_dir_url( __FILE__ ) . 'assets/imagerr-attachment.js', array( 'jquery' ), IMAGERR_VERSION, true );
    289306
     
    291308            if ( isset( $_GET['item'] ) ) {
    292309                $item_id = absint( $_GET['item'] );
     310            }
     311
     312            if ( isset( $_GET['post'] ) ) {
     313                $item_id = absint( $_GET['post'] );
    293314            }
    294315
     
    717738        return $metadata;
    718739    }
     740
     741    /**
     742     * Add Imagerr column to media library
     743     *
     744     * @param array $columns Array of columns.
     745     * @return array Modified array of columns.
     746     */
     747    public function add_imagerr_column( $columns ) {
     748        $columns['imagerr'] = __( 'Imagerr', 'alt-text-imagerr-ai' );
     749        return $columns;
     750    }
     751
     752    /**
     753     * Add content to Imagerr column
     754     *
     755     * @param string $column_name Name of the column.
     756     * @param int    $post_id     Post ID.
     757     */
     758    public function add_imagerr_column_content( $column_name, $post_id ) {
     759        if ( 'imagerr' !== $column_name ) {
     760            return;
     761        }
     762
     763        // Only show for images
     764        if ( ! wp_attachment_is_image( $post_id ) ) {
     765            return;
     766        }
     767
     768        // Add the button HTML
     769        ?>
     770        <div class="imagerr-generate-metadata-wrapper">
     771            <button class="button-primary imagerr-generate-metadata" data-id="<?php echo esc_attr( $post_id ); ?>">
     772                <?php esc_html_e( 'Update with Imagerr', 'alt-text-imagerr-ai' ); ?>
     773            </button>
     774            <div class="imagerr-error" style="display: none; color: red;"></div>
     775            <div class="imagerr-success" style="display: none; color: green;">
     776                <?php esc_html_e( '✅ Image updated', 'alt-text-imagerr-ai' ); ?>
     777            </div>
     778        </div>
     779        <?php
     780    }
    719781}
    720782
  • alt-text-imagerr-ai/trunk/languages/alt-text-imagerr-ai-en_US.po

    r3271433 r3296862  
    33msgstr ""
    44"Project-Id-Version: Alt Text Imagerr AI\n"
    5 "POT-Creation-Date: 2025-04-10 15:55+0100\n"
    6 "PO-Revision-Date: 2025-04-10 15:56+0100\n"
     5"POT-Creation-Date: 2025-05-19 18:02+0100\n"
     6"PO-Revision-Date: 2025-05-19 18:03+0100\n"
    77"Last-Translator: \n"
    88"Language-Team: \n"
     
    2222"X-Poedit-SearchPathExcluded-0: *.min.js\n"
    2323
    24 #: imagerr.php:95 imagerr.php:96
     24#: imagerr.php:99 imagerr.php:100
    2525msgid "Imagerr AI"
    2626msgstr ""
    2727
    28 #: imagerr.php:106 imagerr.php:107
     28#: imagerr.php:110 imagerr.php:111
    2929msgid "Settings"
    3030msgstr ""
    3131
    32 #: imagerr.php:115 imagerr.php:116 templates/generate.php:6
     32#: imagerr.php:119 imagerr.php:120 templates/generate.php:6
    3333msgid "Bulk Generator"
    3434msgstr ""
    3535
    36 #: imagerr.php:135
     36#: imagerr.php:139
    3737msgid ""
    3838"Imagerr AI plugin has been installed. To claim your free trial register on"
    3939msgstr ""
    4040
    41 #: imagerr.php:137
     41#: imagerr.php:141
    4242msgid "You can also check the"
    4343msgstr ""
    4444
    45 #: imagerr.php:138
     45#: imagerr.php:142
    4646msgid "plugin documentation"
    4747msgstr ""
    4848
    49 #: imagerr.php:275 templates/generate.php:31
     49#: imagerr.php:280 templates/generate.php:31
    5050msgid "Update Meta"
    5151msgstr ""
    5252
    53 #: imagerr.php:276
     53#: imagerr.php:281
    5454msgid "✅ Completed"
    5555msgstr ""
    5656
    57 #: imagerr.php:277
     57#: imagerr.php:282
    5858msgid "Generating metadata..."
    5959msgstr ""
    6060
    61 #: imagerr.php:278 templates/generate.php:22
     61#: imagerr.php:283 templates/generate.php:22
    6262msgid "🏃‍♂️‍➡️ Generating..."
    6363msgstr ""
    6464
    65 #: imagerr.php:279
     65#: imagerr.php:284
    6666msgid "🚫 Stopping generation..."
    6767msgstr ""
    6868
    69 #: imagerr.php:304
     69#: imagerr.php:285 imagerr.php:764
     70msgid "✅ Image updated"
     71msgstr ""
     72
     73#: imagerr.php:313 imagerr.php:760
    7074msgid "Update with Imagerr"
    7175msgstr ""
    7276
    73 #: imagerr.php:305
     77#: imagerr.php:314
    7478msgid "Generating..."
    7579msgstr ""
    7680
    7781#. translators: %s: URL to Imagerr account page
    78 #: imagerr.php:375 imagerr.php:418
     82#: imagerr.php:426 imagerr.php:469
    7983#, php-format
    8084msgid ""
     
    8387msgstr ""
    8488
    85 #: imagerr.php:384 imagerr.php:427
     89#: imagerr.php:435 imagerr.php:478
    8690msgid ""
    8791"Sorry, you do not have enough credits to generate metadata. Please add more "
     
    8993msgstr ""
    9094
    91 #: imagerr.php:499
     95#: imagerr.php:550
    9296msgid "Bulk metadata generation started"
    9397msgstr ""
    9498
    95 #: imagerr.php:524
     99#: imagerr.php:575
    96100msgid "Stopping generation..."
     101msgstr ""
     102
     103#: imagerr.php:736
     104msgid "Imagerr"
    97105msgstr ""
    98106
     
    135143msgstr ""
    136144
     145#: templates/generate.php:45
     146msgid "Images not processed"
     147msgstr ""
     148
     149#: templates/generate.php:50
     150msgid "Image ID"
     151msgstr ""
     152
     153#: templates/generate.php:51
     154msgid "Error Message"
     155msgstr ""
     156
    137157#: templates/settings.php:12
    138158msgid "Imagerr Settings"
     
    206226
    207227#. Plugin Name of the plugin/theme
    208 msgid "Alt Text Imagerr AI"
     228msgid "AI Image Alt Text Generator for WordPress – Imagerr AI"
    209229msgstr ""
    210230
    211231#. Description of the plugin/theme
    212232msgid ""
    213 "Generates alt text, titles, descriptions, and captions for your images "
    214 "automatically with AI. Improve your accessibility & SEO."
     233"Generate alt text, titles, descriptions, and captions for your images "
     234"automatically with AI"
    215235msgstr ""
    216236
  • alt-text-imagerr-ai/trunk/languages/alt-text-imagerr-ai.pot

    r3271433 r3296862  
    33msgstr ""
    44"Project-Id-Version: Alt Text Imagerr AI\n"
    5 "POT-Creation-Date: 2025-04-10 15:55+0100\n"
     5"POT-Creation-Date: 2025-05-19 18:02+0100\n"
    66"PO-Revision-Date: 2025-02-22 09:33+0000\n"
    77"Last-Translator: \n"
     
    2222"X-Poedit-SearchPathExcluded-0: *.min.js\n"
    2323
    24 #: imagerr.php:95 imagerr.php:96
     24#: imagerr.php:99 imagerr.php:100
    2525msgid "Imagerr AI"
    2626msgstr ""
    2727
    28 #: imagerr.php:106 imagerr.php:107
     28#: imagerr.php:110 imagerr.php:111
    2929msgid "Settings"
    3030msgstr ""
    3131
    32 #: imagerr.php:115 imagerr.php:116 templates/generate.php:6
     32#: imagerr.php:119 imagerr.php:120 templates/generate.php:6
    3333msgid "Bulk Generator"
    3434msgstr ""
    3535
    36 #: imagerr.php:135
     36#: imagerr.php:139
    3737msgid ""
    3838"Imagerr AI plugin has been installed. To claim your free trial register on"
    3939msgstr ""
    4040
    41 #: imagerr.php:137
     41#: imagerr.php:141
    4242msgid "You can also check the"
    4343msgstr ""
    4444
    45 #: imagerr.php:138
     45#: imagerr.php:142
    4646msgid "plugin documentation"
    4747msgstr ""
    4848
    49 #: imagerr.php:275 templates/generate.php:31
     49#: imagerr.php:280 templates/generate.php:31
    5050msgid "Update Meta"
    5151msgstr ""
    5252
    53 #: imagerr.php:276
     53#: imagerr.php:281
    5454msgid "✅ Completed"
    5555msgstr ""
    5656
    57 #: imagerr.php:277
     57#: imagerr.php:282
    5858msgid "Generating metadata..."
    5959msgstr ""
    6060
    61 #: imagerr.php:278 templates/generate.php:22
     61#: imagerr.php:283 templates/generate.php:22
    6262msgid "🏃‍♂️‍➡️ Generating..."
    6363msgstr ""
    6464
    65 #: imagerr.php:279
     65#: imagerr.php:284
    6666msgid "🚫 Stopping generation..."
    6767msgstr ""
    6868
    69 #: imagerr.php:304
     69#: imagerr.php:285 imagerr.php:764
     70msgid "✅ Image updated"
     71msgstr ""
     72
     73#: imagerr.php:313 imagerr.php:760
    7074msgid "Update with Imagerr"
    7175msgstr ""
    7276
    73 #: imagerr.php:305
     77#: imagerr.php:314
    7478msgid "Generating..."
    7579msgstr ""
    7680
    7781#. translators: %s: URL to Imagerr account page
    78 #: imagerr.php:375 imagerr.php:418
     82#: imagerr.php:426 imagerr.php:469
    7983#, php-format
    8084msgid ""
     
    8387msgstr ""
    8488
    85 #: imagerr.php:384 imagerr.php:427
     89#: imagerr.php:435 imagerr.php:478
    8690msgid ""
    8791"Sorry, you do not have enough credits to generate metadata. Please add more "
     
    8993msgstr ""
    9094
    91 #: imagerr.php:499
     95#: imagerr.php:550
    9296msgid "Bulk metadata generation started"
    9397msgstr ""
    9498
    95 #: imagerr.php:524
     99#: imagerr.php:575
    96100msgid "Stopping generation..."
     101msgstr ""
     102
     103#: imagerr.php:736
     104msgid "Imagerr"
    97105msgstr ""
    98106
     
    135143msgstr ""
    136144
     145#: templates/generate.php:45
     146msgid "Images not processed"
     147msgstr ""
     148
     149#: templates/generate.php:50
     150msgid "Image ID"
     151msgstr ""
     152
     153#: templates/generate.php:51
     154msgid "Error Message"
     155msgstr ""
     156
    137157#: templates/settings.php:12
    138158msgid "Imagerr Settings"
     
    206226
    207227#. Plugin Name of the plugin/theme
    208 msgid "Alt Text Imagerr AI"
     228msgid "AI Image Alt Text Generator for WordPress – Imagerr AI"
    209229msgstr ""
    210230
    211231#. Description of the plugin/theme
    212232msgid ""
    213 "Generates alt text, titles, descriptions, and captions for your images "
    214 "automatically with AI. Improve your accessibility & SEO."
     233"Generate alt text, titles, descriptions, and captions for your images "
     234"automatically with AI"
    215235msgstr ""
    216236
  • alt-text-imagerr-ai/trunk/readme.txt

    r3279851 r3296862  
    1 === AI Image Alt Text Generator - Imagerr AI ===
     1=== AI Image Alt Text Generator for WordPress – Imagerr AI ===
    22Contributors: andrejdivi, dbeja
    33Donate link: https://www.paypal.com/paypalme/dbkode
    44Tags: ai, image, alt, text, generator
    55Requires PHP: 5.2
    6 Requires at least: 3.0
    7 Stable tag: 1.1.1
     6Requires at least: 4.6
     7Stable tag: 1.1.2
    88Tested up to: 6.8
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Generate alt text, titles, descriptions, and captions for your images automatically with AI — now with full post content updates and support for Divi & Elementor.
     12Generate alt text, titles, descriptions, and captions for your images automatically with AI
    1313
    1414== Description ==
     
    6969== Changelog ==
    7070
     71= 1.1.2 =
     72* Fixed issue where the "Update with Imagerr" button didn't work after navigating between images in the media modal
     73* Added "Update with Imagerr" button to the Edit Attachment page for easier access
     74* Added "Update with Imagerr" button to the Media Library list view (images table)
     75* Minor UI tweaks and performance improvements
     76
    7177= 1.1.1 =
    7278* Improved bulk generation process with automatic retries for failed images
Note: See TracChangeset for help on using the changeset viewer.