Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mjHollerATme

    (@mjholleratme)

    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.

    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'];
    
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not working anymore in 3.9?’ is closed to new replies.