/ForVoyez-Wordpress-plugin

it's the wordpress plugin to use ForVoyez API

Primary LanguagePHP

ForVoyez Auto Alt Text for Images

WordPress PHP License

A powerful WordPress plugin for the ForVoyez platform that automatically generates SEO-optimized alt text for images.

Table of Contents

Description

ForVoyez Auto Alt Text for Images is a WordPress plugin that leverages AI technology to automatically generate high-quality, SEO-friendly alt text for images in your content. This plugin enhances your website's accessibility and search engine optimization effortlessly.

Features

  • 🤖 AI-powered alt text generation
  • 🖼️ Bulk processing for existing images
  • 🔄 Automatic processing for new uploads
  • 🎨 Customizable output formats
  • 🌐 Multi-language support
  • 🧰 User-friendly WordPress admin interface

Requirements

  • WordPress 5.0 or higher
  • PHP 8.2 or higher
  • Composer
  • Node.js and npm

Installation

  1. Download the plugin zip file or clone the repository:

    git clone https://github.com/forvoyez/auto-alt-text-for-images.git
  2. Navigate to the plugin directory:

    cd auto-alt-text-for-images
  3. Install PHP dependencies:

    composer install
  4. Install Node.js dependencies:

    npm install
  5. Activate the plugin through the WordPress admin interface.

Configuration

  1. Go to the ForVoyez Auto Alt Text settings page in your WordPress admin area.
  2. Enter your ForVoyez API key.
  3. Configure any additional settings according to your preferences.

Usage

After installation and configuration:

  1. The plugin will automatically generate alt text for new image uploads.
  2. To process existing images:
    • Go to Media Library
    • Select the images you want to process
    • Choose "Generate Alt Text" from the bulk actions dropdown
  3. You can manually edit any generated alt text as needed.

Development

BrowserSync Configuration

To use BrowserSync with your WordPlate project:

  1. Create a bs-config.cjs file in the project root:

    module.exports = {
    	proxy: 'localhost:8000', // Replace with your PHP server port
    	files: [
    		'public/**/*.php',
    		'resources/**/*.php',
    		'public/**/*.css',
    		'public/**/*.js',
    	],
    	notify: false,
    }
  2. Start the PHP server:

    php -S localhost:8000 -t public
  3. Start BrowserSync:

    browser-sync start --config bs-config.cjs

BrowserSync will now monitor specified files and auto-reload your browser on changes.

Project Structure

├── assets/
├── includes/
├── templates/
├── tests/
├── bs-config.cjs
├── composer.json
├── package.json
├── auto-alt-text-for-images.php
├── README.md
└── ...

Debugging and Troubleshooting

If you want to know what is going on, install and run the plugin. Then, in the code, add the following line:

error_log(print_r($variable, true));

This will print the variable to the PHP error log. You can find the log file location in your PHP configuration. search for error_log in your php.ini file. for linux it is usually /var/log/php/php_error.log for windows it is usually C:\php\logs\php_error.log or C:\wamp64\logs\php_error.log you can also use phpinfo() to find the log file location.

then to stream the log file to your terminal, use the following command:

tail -f /var/log/php/php_error.log

and for windows :

Get-Content C:\php\logs\php_error.log -Wait -Tail 10

Screenshots

  1. API Configuration API Configuration The plugin's configuration interface allows easy setup of your ForVoyez API key. This page provides step-by-step instructions on how to obtain and configure your API key to start using the plugin.

  2. Image Management Interface Image Management Interface The main image management dashboard of the plugin. It displays a grid view of your WordPress media library with visual indicators for missing metadata. Users can easily select and analyze images individually or in bulk.

  3. Results Example Results Example This screenshot showcases the plugin's ability to generate high-quality alt text and meta descriptions. It displays examples of automatically generated titles, alt texts, and captions for a variety of image types, demonstrating the AI's versatility and accuracy.

Certainly. Here's the README section in English:

Test Environment Setup

To run the tests for this plugin, you'll need a MySQL/MariaDB database with a root user having all privileges. Here are the steps to set up your environment:

Prerequisites

  • MySQL or MariaDB installed
  • Composer
  • PHP 7.4 or higher

Database Configuration

  1. Log in to MySQL as root:

    sudo mysql -u root -p
    

    Enter the root password if prompted.

  2. Grant all privileges to the root user:

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
  3. If the above command fails, follow these troubleshooting steps:

    a. Stop the MariaDB service:

    sudo systemctl stop mariadb
    

    b. Ensure no MySQL processes are running:

    ps aux | grep mysql
    

    If processes are found, stop them:

    sudo kill -9 [PID]
    

    c. Start MySQL in safe mode:

    sudo mysqld_safe --skip-grant-tables --skip-networking &
    

    d. Repair the database tables:

    sudo mysqlcheck -u root --repair --all-databases
    

    or

    sudo mysqlcheck -u root --skip-password --repair --all-databases
    

    e. Log in to MySQL and reset the root password:

    mysql -u root
    
    FLUSH PRIVILEGES;
    USE mysql;
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
    FLUSH PRIVILEGES;
    EXIT;

    f. Restart MySQL normally and grant privileges:

    sudo systemctl start mariadb
    mysql -u root -p
    
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
    FLUSH PRIVILEGES;

Running the setup Tests

Once the database is configured, you can run the install db tests with the following command:

composer run install-wp-tests

This command will install the WordPress test environment and run the plugin's unit tests. If you encounter any issues while running the tests, make sure the database connection information in the bin/install-wp-tests.sh file is correct.

Running the tests

To run the tests, use the following command:

./vendor/bin/phpunit [file path].php

Made with ❤️ by ForVoyez