WordPress.org

Ready to get started?Download WordPress

Forums

JW Player for Flash & HTML5 Video
[resolved] [Plugin: JW Player Plugin for WordPress] JW Player breaks WordPress Media Editor (2 posts)

  1. gwrey
    Member
    Posted 4 years ago #

    With the JW Player plugin activated the Media Editor will not save edited images, you get a Javascript Syntax error "Unable to parse JSON string".

    To reproduce, edit any image in the Media Library and crop, rotate or flip the image then click the "Save" button; you'll see the spinner, but nothing will happen. If you debug the JavaScript you'll see the syntax error. If you deactivate the plugin and try the same steps, it works fine.

    To fix it I edited media/JWMediaFunctions.php and modified the url_attached_file function to check the mime type of the media file and only act on video files.

    Here is the updated function:

    function url_attached_file($file, $attachment_id) {
    	if (substr($post["post_mime_type"], 0, 5) == "video") {
    		$upload_dir = wp_upload_dir();
    		return str_replace($upload_dir["basedir"] . "/", "", $file);
    	} else {
    		return $file;
    	}
    }

    http://wordpress.org/extend/plugins/jw-player-plugin-for-wordpress/

  2. JW Player
    Member
    Plugin Author

    Posted 3 years ago #

    Hi gwrey,

    Thanks for catching that bug. I'm currently working on an update right now and will be sure to include that fix.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic