Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author sewpafly

    (@sewpafly)

    Quick check: the latest PTE changed the link to a button (CSS-styling).

    This button/link is added via javascript, so there is probably some sort of a conflict, which could depend on the browser that you are using. In chrome it’s pretty simple to press ctrl+shift+j to see if there have been any javascript exceptions, firefox and IE have similar methods.

    If you see an exception you can report it here and I’ll see if I can make a fix for it. Typically these types of errors are caused by conflicts between plugins, so you could also try disabling other plugins to find which one conflicts and then I can look into it as well.

    Thread Starter fishnyc22

    (@fishnyc22)

    Hey, thanks for the quick reply. REALLY appreciate it.

    I had actually already checked to see if there was a javascript error. No javascript warnings are popping up at all on Safari or Chrome. I’ll try disabling some plugins and see if it shows up. Will post results.

    Thx again.

    Thread Starter fishnyc22

    (@fishnyc22)

    I should maybe also mention in case it’s relevant. I am using this on a custom post type that has no editor window. I use “Gallery Metabox” plugin to create a list of thumbnails where the editor would normally be. This plugin also adds a “Manage Images” link which takes the user to the Manage Images Modal.

    The link for each post looks like this.
    http://www.domain.com/wp-admin/media-upload.php?post_id=14756&type=image&tab=gallery&TB_iframe=1&width=640&height=758

    If I am in a PAGE and click on the new ADD MEDIA button. I do see the Post Thumbnail Editor when I highlight an image.

    Hope this helps. Thanks.

    Plugin Author sewpafly

    (@sewpafly)

    I think that I duplicated the problem, using that plugin. I used to have support for that modal, but pulled it for wordpress 3.5. I’ll investigate to see if it’s as simple as adding it back, or if there is more effort required.

    Thread Starter fishnyc22

    (@fishnyc22)

    Ah. Awesome. Thanks so much. I may modify Gallery Metabox plugin so that on click of an image takes you right to the PTE editor. Gotta see if thats possible but you’re fix would be great as well. Thanks pal!

    Plugin Author sewpafly

    (@sewpafly)

    Quick fix: Add this to your post-thumbnail-editor.php file:

    add_action( 'media_upload_library', 'pte_admin_media_scripts_image' );
    function pte_admin_media_scripts_image(){
    	pte_admin_media_scripts('attachment');
    }

    It’s not perfect. I had to scroll down to see the thumbnail table, but it works. Let me know what you think and I’ll see if i can get a bit nicer interface/integration for the next release.

    Thread Starter fishnyc22

    (@fishnyc22)

    Hey Sewpafly. I just got around to trying this (sorry for the delay). I dropped in the code into the bottom of post-thumbnail-editor.php but don’t see the “post thumbnail editor” link on the Manage Images > Gallery modal. I click on SHOW next to an image and usually would see “Post Thumbnail Editor” in that accordion. Also don’t see the link when I click on EDIT IMAGE in that window. Any idea why? Thanks again for the help. Really appreciate it.

    I’d like to use the old Manage images modal for now until wordpress fixes the botched update to the new Media Viewer. I posted in the WordPress feature req area about my issues with it if you want to read it.

    Plugin Author sewpafly

    (@sewpafly)

    Sounds like soumething’s borked šŸ™ You can download a version with the fix here. Or you can try the absolute latest, here.

    What are the issues with the new Media Viewer? I haven’t seen any problems other than a lack of documentation on hacking it.

    Thread Starter fishnyc22

    (@fishnyc22)

    Thanks I’ll give it a shot right now in a few minutes and let you know if it worked.

    The fine WordPress folks have the media viewer set up to default to “All Media Items”. On an image heavy site it pretty much locks up the screen for quite some time before you can even click on the dropdown to switch it to “uploaded to this post” which “SHOULD” be the default selection. What makes it worse is that its loading the FULL size images making the load times even longer. In my case, i’m dealing with high res files (2-8MB) that are there for generating printable PDFs. And my client is on a slow T1 which takes forever.

    I’ve been scouring the forums trying to find a way to hack this so that “Uploaded to this post” is the default (without using javascript after the page has loaded to SWITCH the selection in the drop down… which still causes the big delay).

    The Media View should really default to “Uploaded to this post” and it should load in a Medium thumbnail or smaller.

    Thread Starter fishnyc22

    (@fishnyc22)

    Hey Pal. I tried fixed version but i’m still not seeing the PTE link in the older modal box. Just to clarify in case we’re talking about different things. I have a button in my edit post page that opens the old modal.

    /wp-admin/media-upload.php?post_id=15154&type=image&tab=gallery&TB_iframe=1&width=640&height=707

    This opens up the older modal window. Previously I could click on SHOW to see the details on the uploaded images and click the PTE link to recrop the images. Also if I click on the EDIT IMAGE button under the thumbnail, i’d also see the PTE link at the bottom of the right column. But its not in either places.

    Here are a couple of screenshots

    BTW. PTE is the greatest plugin. It really give me a lot of flexibility when building custom themes. Thanks again.

    Plugin Author sewpafly

    (@sewpafly)

    First, here’s a small fix for the media library to open with only the attached images… This doesn’t fix the filter dropdown menu, but I don’t have that kind of time right now šŸ™‚ .

    var oldPost = wp.media.view.MediaFrame.Post;
    wp.media.view.MediaFrame.Post = oldPost.extend({
        initialize: function() {
            oldPost.prototype.initialize.apply( this, arguments );
            this.states.get('insert').get('library').props.set('uploadedTo', wp.media.view.settings.post.id);
        }
    });

    And for whatever reason, it wasn’t working for me either until I added these additional lines (on line 145 of post-thumbnail-editor.php):

    add_action( 'media_upload_gallery', 'pte_admin_media_scripts_editor' );
    add_action( 'media_upload_image', 'pte_admin_media_scripts_editor' );

    This should open the PTE interface inside the thickbox, which isn’t ideal, but I wanted to get your feedback on whether I should add code that made it open in an external window or not…

    Let me know if that works for you.

    Thread Starter fishnyc22

    (@fishnyc22)

    Hey pal, thanks for the help again. REALLY appreciate it. Anxious to try and fix the issue with “uploaded to this post”. I’m confused as to where the first block of code goes. I’m assuming within my javascript file. Inside the block that runs after the page is loaded?

    Is the second block of code above for fixing the old modal. Sorry a bit confused. If the first block prevents all media items from loading by default I don’t think I’ll need to worry about the second issue.

    Also line 145 of post-thumbnail-editor.php is in the middle of
    function pte_admin_media_scripts()
    is that right?

    Thanks again

    Plugin Author sewpafly

    (@sewpafly)

    You can hook the javascript bit in anywhere (throw it in a file and call enqueue_scripts on it). It just has to be loaded before the “add media” button is pressed.

    Here’s some more context for the php code:

    /*
     * Put Hooks and immediate hook functions in this file
     */
    
    /** For the "Edit Image" stuff **/
    /* Hook into the Edit Image page */
    add_action('dbx_post_advanced', 'pte_edit_form_hook_redirect');
    /* Slight redirect so this isn't called on all versions of the media upload page */
    function pte_edit_form_hook_redirect(){
    	add_action('add_meta_boxes', 'pte_admin_media_scripts');
    }
    
    // *********************************************************
    // These are the new bits
    // *********************************************************
    
    add_action( 'media_upload_library', 'pte_admin_media_scripts_editor' );
    add_action( 'media_upload_gallery', 'pte_admin_media_scripts_editor' );
    add_action( 'media_upload_image', 'pte_admin_media_scripts_editor' );
    function pte_admin_media_scripts_editor(){
    	pte_admin_media_scripts('attachment');
    }
    
    // *********************************************************
    
    function pte_admin_media_scripts($post_type){
    	$options = pte_get_options();
    	wp_enqueue_script( 'pte'
    		, PTE_PLUGINURL . 'apps/coffee-script.js'

    Thread Starter fishnyc22

    (@fishnyc22)

    Sewpafly. You sir, are the best!. That piece of JS code worked perfectly. The page no longer loads the “All Media Items” images anymore and loads the “Uploaded to this post” images. I added this piece of JS code to get to switch the drop down.

    var called = 0;
        $('#wpcontent').ajaxStop(function() {
            if ( 0 == called ) {
                $('[value="uploaded"]').attr( 'selected', true );
                called = 1;
            }
        });

    I may share this with the good folks on other forums looking for this tip and of course credit you and your fine work!

    By any chance would you know if there’s a way to switch this from loading the FULL size image and instead loading a thumb or medium size image. I have a feeling that the JS is using the image or the image’s URL somewhere else and changing the size may affect other things negatively. But would be curious to know if it was possible.

    Thanks also for the clarity of the PTE editor for the old modal. The fix above may mean I don’t have to use it but I did get it working. It loading in the modal isn’t the ideal functionality but definitely helps me out.

    Just sent you a small donation on your plugin page. Thank so much for the help. I REALLY appreciate it.

    Plugin Author sewpafly

    (@sewpafly)

    @fishnyc – Thanks so much for the kind words — and the donation. You’re my second one in 2 years.

    From what I can tell the media editor is supposed to default to the ‘medium’ size (see line 3048 and 2903 of wp-includes/js/media-views.js), and wordpress appears to be using my medium sized images. I don’t know what to tell you if you are seeing different behavior.

    Anyways, glad I could help and thanks again!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘No Link to PTE on Manage Images modal’ is closed to new replies.