• Resolved Thinkpatience

    (@thinkpatience)


    Hey,

    First, thanks for the great plugin, it’s been a huge help on my current project, but I seem to be having an issue with my recent server migration. The image to edit doesn’t appear.

    I was recently having server issues with an Amazon EC2 instance that my website was hosted on, so I was forced to back everything up with UpdraftPlus Backup and Restoration – I took a backup of everything, Uploads/Database, created a new EC2 Instance and Database, assigned a new IP address, updated WordPress from 3.9 to 4.0 and restored. A near identical clone.

    I didn’t use their Migrator plugin because I figured everything would be fine since the URL wasn’t changing. It seems like it goes through and changes DB prefixes/URLs

    Everything but this plugin (Post Thumbnail Editor) seems to be working fine. I started the error log (for the plugin), but nothing came up. When I looked at the JS Console in Firefox and “click crop and save”… I see this JS error:

    main.js – line 20

    Error: u.thumbnails is undefined
    e.submitCrop/u</<@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:130981
    .each@http://mysite.com/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate&ver=4.0:2:2969
    e.submitCrop/u<@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:130941
    u/</T[o]/y<@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:103785
    an/o/l.promise.then/l@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:46050
    an/u/<.then/<@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:46737
    fn/this.$get</u.prototype.$eval@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:50713
    fn/this.$get</u.prototype.$digest@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:49586
    fn/this.$get</u.prototype.$apply@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:51052
    s@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:33791
    g@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:35702
    jt/</S.onreadystatechange@http://mysite.com/wp-content/plugins/post-thumbnail-editor/js-build/main.js:20:36184

    I’ve also noticed that there are 2 ../admin-ajax.php files that return a 200, but they look like the call for the image

    Type: Image
    Status: 200
    …but no image…

    http://mysite.com/wp-admin/admin-ajax.php?action=pte_imgedit_preview&_ajax_nonce=f4de6463ef&postid=873&rand=20098

    http://mysite.com/wp-admin/admin-ajax.php?action=pte_imgedit_preview&_ajax_nonce=f4de6463ef&postid=873&rand=20098

    Any ideas on what could be going on…?

    P.S. The post that have previously been modified, display their crops in the “View” tab, but the original problem is still around.

    Thanks.

    https://ww.wp.xz.cn/plugins/post-thumbnail-editor/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Thinkpatience

    (@thinkpatience)

    I think this is why I’m having issues with a log displaying… any idea on how I can give it permissions?

    Just turned WP_DEBUG on and got this on the post editor page:

    Warning: touch(): Unable to create file /var/www/wordpress/wp-content/uploads/ptetmp/log.txt because Permission denied in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/log.php on line 104
    
    Warning: fopen(/var/www/wordpress/wp-content/uploads/ptetmp/log.txt): failed to open stream: Permission denied in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/log.php on line 144
    
    Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/log.php on line 145
    
    Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/log.php on line 146
    
    Warning: fopen(/var/www/wordpress/wp-content/uploads/ptetmp/log.txt): failed to open stream: Permission denied in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/log.php on line 144
    
    Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/log.php on line 145
    
    Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/log.php on line 146
    Plugin Author sewpafly

    (@sewpafly)

    This actually might be why it’s failing in the first place.

    PTE tries to write to a temporary directory that it creates in the wordpress uploads directory (uploads/ptetmp). I imagine that creating the directory succeeded, but the directory doesn’t have the right (write 🙂 )permissions.

    If the directory exists, can you change permissions such that it has read/write access (a+rw or 755)?

    If the directory doesn’t exist, try creating it, and making sure that the permissions are correct.

    Thread Starter Thinkpatience

    (@thinkpatience)

    Thanks for the quick reply, I definitely think it has something to do with permissions – I just set up another EC2 instance with just he plugin, blank WordPress… same problem.

    In case you’re interested… I followed this guide to create the server (Skipping the user/port change, starting at Installing WordPress all moving down to Configure WordPress):
    http://code.tutsplus.com/tutorials/installing-wordpress-in-the-amazon-cloud–cms-21126

    Sorry, I’m not great at server admin, but I’m going to try what you suggested and report back…

    Thread Starter Thinkpatience

    (@thinkpatience)

    I meant to say that I just created another instance with a blank install of WordPress using the guide linked above followed exactly (the guide was also used on the production server) and it didn’t work,

    The entire WordPress install has 777 on it at the moment and it still doesn’t work. Could it have something to do with ownership?

    Uploads Folder:
    drwxrwxrwx 4 www-data www-data 4096 Oct 9 19:13 uploads

    Inside Uploads (Just created the ptetmp folder):
    drwxrwxrwx 3 www-data www-data 4096 Oct 9 18:53 2014
    drwxr-xr-x 2 www-data www-data 4096 Oct 9 19:13 ptetmp

    Plugin Author sewpafly

    (@sewpafly)

    That looks correct, but it could be that PTE thinks it should be opening somewhere else. Could you make a small change in the plugin for me and tell me what happens?

    Lines 153-162 look like this:

    /**
     * Used in functions.php, log.php & options.php to get pseudo-TMP file paths
     */
    function pte_tmp_dir()
    {
    	$uploads 	    = wp_upload_dir();
    	$PTE_TMP_DIR    = $uploads['basedir'] . DIRECTORY_SEPARATOR . "ptetmp" . DIRECTORY_SEPARATOR;
    	$PTE_TMP_URL    = $uploads['baseurl'] . "/ptetmp/";
    	return compact( 'PTE_TMP_DIR', 'PTE_TMP_URL' );
    }

    Can you change this so that:

    /**
     * Used in functions.php, log.php & options.php to get pseudo-TMP file paths
     */
    function pte_tmp_dir()
    {
    	$uploads 	    = wp_upload_dir();
    	$PTE_TMP_DIR    = $uploads['basedir'] . DIRECTORY_SEPARATOR . "ptetmp" . DIRECTORY_SEPARATOR;
    	$PTE_TMP_URL    = $uploads['baseurl'] . "/ptetmp/";
            var_dump($PTE_TMP_DIR);
    	return compact( 'PTE_TMP_DIR', 'PTE_TMP_URL' );
    }

    This should output a section on every page (maybe only when you try to access PTE?) about where the temp directory should be.

    Thread Starter Thinkpatience

    (@thinkpatience)

    Hey, made the change and nothing seemed to show up. Not sure if this is helpful, but I got this error when I enabled “Check this to save the generated working image to disk instead of creating on the fly (experimental)”:

    string(45) “/var/www/wordpress/wp-content/uploads/ptetmp/”

    Fatal error: Call to undefined method WP_Error::resize() in /var/www/wordpress/wp-content/plugins/post-thumbnail-editor/php/functions.php on line 298

    This is with the change.

    I’m also getting this JS console error in the editor page:

    Error: [ngRepeat:dupes] http://errors.angularjs.org/1.2.1/ngRepeat/dupes?p0=thumbnail%20in%20thumbnails&p1=string%3Ar
    F/<@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:6:440
    qe</<.link/<@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:182:228
    xd/this.$get</g.prototype.$watchCollection/<@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:98:35
    xd/this.$get</g.prototype.$digest@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:98:432
    xd/this.$get</g.prototype.$apply@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:101:155
    g@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:67:162
    Q@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:71:64
    md/</t.onreadystatechange@http://54.172.4.164/wp-content/plugins/post-thumbnail-editor/apps/angular/angular.min.js:72:27
    Plugin Author sewpafly

    (@sewpafly)

    Okay, that first one (string(45) "/var/www/wordpress/wp-content/uploads/ptetmp/") was the output of the var_dump command. You can remove that line now.

    Line 298 calls $editor->resize(), but it’s saying that $editor is of type WP_ERROR. I get this from wp_get_image_editor(), which is a wordpress function, and I can’t think why this would be failing. It could be because the graphics processing library isn’t installed. If you inspect php_info(), does your new system have the gd or imagemagick plugins installed?

    BTW, I’m pretty sure this is a wordpress/php issue and not javascript, but one thing you could check is that when the PTE editor starts it should make an additional call to get the thumbnail information (you can see within the chrome dev tools, on the network tab). I’m betting that this isn’t completing correctly and you’re getting either nothing or some error.

    Thread Starter Thinkpatience

    (@thinkpatience)

    Boom! That was it, thanks for the help, I was just looking around at my Apache install to see if there was anything missing… comparing with other WordPress sites… honestly I didn’t know what I was looking for, thanks for letting me know.

    I didn’t have either, so I ran

    apt-get update
    apt-get install php5-gd
    apt-get install imagemagick php5-imagick
    service apache2 restart

    and now it all works!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Image doesn't appear in editor.’ is closed to new replies.