PHP code example of josantonius / wp-image-handler

1. Go to this page and download the library: Download josantonius/wp-image-handler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

josantonius / wp-image-handler example snippets


WP_Image::save($url, $post_ID, $featured);

WP_Image::upload($url, $filename);

WP_Image::delete_all_attachment($post_ID, $force);



use Josantonius\WP_Image;



use Josantonius\WP_Image\WP_Image;

WP_Image::upload('https://site.com/image.png', 'image.png');

WP_Image::upload('https://site.com/image.png', '18');

WP_Image::upload('https://site.com/image.png', '18', true);

WP_Image::delete_all_attachment(18);

WP_Image::delete_all_attachment('18', true);