WordPress.org

Ready to get started?Download WordPress

Forums

Image downsizing in my plugin (1 post)

  1. nicosFR
    Member
    Posted 5 years ago #

    Hi,

    I'm writing a plugin and in which I need to resize an image located in my wp-content/uploads/ folder.

    So I'm trying to use the image_resize() function from the wp-includes/media.php file. But I get the following error:

    Call to undefined function wp_load_image() in /wp-includes/media.php

    here is my plugin code:

    add_action('rss2_item','addEnclosure');
    
    function addEnclosure() {
    	$isvideo=0;
    	foreach((get_the_category()) as $category) {
        	if  ($category->cat_ID == 1) {
        		$isvideo++;
        	}
    	}
    
    	if ($isvideo >= 1) {
    		...
    		$image = 'my image url';
    
    		$imageThumb = image_resize($image, 50, 50, true, 'feed', null, 90);
    
    	}
    
    }

Topic Closed

This topic has been closed to new replies.

About this Topic