Option for generating image alternative text suggestions

Created on 20 June 2024, 6 months ago
Updated 27 August 2024, 4 months ago

Would it be possible to use this module to feed media images to ChatGPT (or another AI tool) and get automatic alternative text suggestions?

Feature request
Status

Active

Version

1.0

Component

OpenAI ChatGPT

Created by

🇺🇸United States w01f

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @w01f
  • 🇺🇸United States Mohammed J. Razem Santa Clara, CA
  • 🇮🇳India babu_ankaian

    Hi,

    I am here suggesting other AI tool ALTTEXTAI to generate image alternative text. Also we have Drupal module Automatic Alternative Text to support generate ALT Text for uploaded media file.

    Example Code:

        $data = array(
    		'image' => array(
    			'url' => 'https://upload.wikimedia.org/wikipedia/commons/6/63/Monarch_In_May.jpg'
    		),
    	);
    	$json_data = json_encode($data);
    
    	$Curl = 'https://alttext.ai/api/v1/images';
    	$access = '146971ebfd0cf123d9126f1e9e89f065';
    	$ch1 = curl_init();
    	curl_setopt($ch1, CURLOPT_URL,$Curl);
    	curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'X-API-Key: '.$access));
    	curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch1, CURLOPT_CUSTOMREQUEST,"POST");
    	curl_setopt($ch1, CURLOPT_POSTFIELDS, $json_data);
    	
    	$status_code = curl_getinfo($ch1, CURLINFO_HTTP_CODE); 
    	$result = curl_exec($ch1);
    	curl_close($ch1);
    	$response = json_decode($result, true);
    
    	$response1 = array(
    		"alt_text" => $response['alt_text'],
    		"img_url" => $url,
    	);
    	echo json_encode($response1);
    
    
Production build 0.71.5 2024