WordPress.org

Ready to get started?Download WordPress

Forums

ImageFX
[resolved] Not working anymore in 3.9? (3 posts)

  1. mjHollerATme
    Member
    Posted 3 months ago #

    Hi,

    since 3.9 images are not being generated by the plugin anymore on my site. Should I downgrade wp or will there be a new version anytime soon?

    Regards,
    Jonathan

    https://wordpress.org/plugins/imagefx/

  2. mjHollerATme
    Member
    Posted 3 months ago #

    ok this was written in some kind of panic, so I'll mark this as solved. Instead my CO-worker with nickname tripawhat made a new support request that is more differentiated.
    Actually it seems to work when using Media > add File and ONLY JPG-format to upload the images. In this case thumbnails are being generated. But when using the uploader in Posts or anywhere else than "wp menu > media > add file" it doesn´t work. Also when trying to upload PNG-Files.

  3. Lisa
    Member
    Posted 3 months ago #

    The issue with image formats other than JPG can be 'fixed' as follows:

    In imagefx.php, change this part of the code

    if ( IMAGETYPE_JPEG === $orig_type || apply_filters( 'imagefx_image_type', false, $orig_type ) ) {
    
    	$image = wp_load_image( $file );
    
    	$callback( $image );
    
    	$slug = $options['slug'][$size];
    	if ( ! empty( $slug ) ) {
    
    		$newfile = substr( $file, 0, -4 ) . '-' . $slug . substr( $file, -4 );
            	$info['file'] = substr( $info['file'], 0, -4 ) . '-' . $slug . substr( $info['file'], -4 );
    
    	} else {
    		$newfile = $file;
    	}
    
    	if ( IMAGETYPE_JPG == $orig_type )
    		imagejpeg( $image, $newfile );
    
    	do_action( 'imagefx_image_create', $image, $newfile, $orig_type );
    
    	$meta['sizes'][$size]['file'] = $info['file'];
    
    }

    to this

    if ( IMAGETYPE_JPEG === $orig_type || IMAGETYPE_GIF === $orig_type || IMAGETYPE_PNG === $orig_type || IMAGETYPE_JPEG2000 === $orig_type || apply_filters( 'imagefx_image_type', false, $orig_type ) ) {
    
    	$image = wp_load_image( $file );
    
    	$callback( $image );
    
    	$slug = $options['slug'][$size];
    	if ( ! empty( $slug ) ) {
    
    		$filename_parts = explode('.', $file);
    		$extension = array_pop($filename_parts);
    		$newfile = implode('.', $filename_parts) . '-' . $slug . '.' . $extension;
    
    		$filename_parts = explode('.', $info['file']);
    		$extension = array_pop($filename_parts);
    		$info['file'] = implode('.', $filename_parts) . '-' . $slug . '.' . $extension;
    
    	} else {
    		$newfile = $file;
    	}
    
    	if ( IMAGETYPE_GIF == $orig_type ) {
    		imagegif( $image, $newfile );
    	} else if ( IMAGETYPE_PNG == $orig_type ) {
    		imagepng( $image, $newfile );
    	} else {
    		imagejpeg( $image, $newfile );
    	}
    
    	do_action( 'imagefx_image_create', $image, $newfile, $orig_type );
    
    	$meta['sizes'][$size]['file'] = $info['file'];
    
    }

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.