staffordgables / wp-drive-to-image-converter

A WordPress plugin that allows users to convert Google Drive links to Google Image links directly within a WordPress post or page.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This code creates a WordPress plugin that allows users to convert Google Drive links to Google Image links directly within a WordPress post or page.

Plugin Information:

It defines a WordPress plugin named "Drive to Image Converter" with a description, version, and author information.

Shortcode Function:

It defines a function called drive_to_image_shortcode. This function generates a form in which users can input a Google Drive link.

Form Handling:

When the form is submitted, the code checks if a Google Drive link has been entered. If a link is provided, it attempts to convert it to a Google Image link using the convert_drive_to_image_link function.

Conversion Function:

convert_drive_to_image_link takes a Google Drive link as input and attempts to extract a unique ID from it. If successful, it constructs a Google Image link using this ID and returns it.

Displaying the Results:

If a valid Google Image link is generated, it is displayed as a clickable link. Additionally, an tag is used to display the image itself on the page.

Shortcode Registration:

It registers the drive_to_image_shortcode function as a shortcode called [drive_to_image_converter]. This allows users to embed the form and functionality in any post or page using the shortcode.

Usage in WordPress:

Once the plugin is installed and activated, you can use the shortcode [drive_to_image_converter] in any post or page. This will display a form where users can input a Google Drive link. Upon submission, the plugin will convert and display the Google Image link along with the image itself.

About

A WordPress plugin that allows users to convert Google Drive links to Google Image links directly within a WordPress post or page.


Languages

Language:PHP 100.0%