Support » Plugin: Imsanity » Images don't resize when uploaded via mobile device

Viewing 15 replies - 1 through 15 (of 18 total)
  • +1.

    Running from WordPress App on both iPhone and iPod Touch (running iOS 8), images uploaded from mobile aren’t being resized by the plugin.

    Images uploaded from computer are still working.

    +1

    I found this too. It would make this plugin perfect so my non-tech sister can have nice and fast loading images on her blog. The Prizm plugin does work to compress the images so I like to use these two plugins together.

    This would be great additional functionality to have. Is this on the roadmap? Is it something we could fund the development of?

    I am planning to work on this once I get some work-related stuff finished. The strange thing is that resizing from the mobile app has always worked for me and many others, but I haven’t figured out quite why. I kinda suspect it’s due to which remote API is being used – the new Jetpack JSON API, or the older XML-RPC.

    Anyway, Imsanity hooks into wp_handle_upload, which for whatever reason seems to not fire in the XML-RPC for some versions of WordPress. Other plugins that do image handling instead hook into the wp_generate_attachment_metadata which seems like it does. So I might just switch but I’m sure there are going to be glitches with the new hook so I need to find the time to learn it and test for a variety of situations.

    I’m pretty sure that it previously was working. It must be a recent change in the iOS WordPress app. Thanks for looking into this.

    I am using WP 4.3 and it seems that wp_handle_upload is being called properly. However I noticed how the $params differ from a mobile upload. Basically when uploading from a mobile we only get the file name in ‘file’ as opposed to the full file path in a regular upload. This causes file_exists to fail.

    Jason

    (@verysimple)

    Hmm that’s interesting, I wonder if that’s technically a bug with WordPress..? I’ll have to take a look and see if there is something I can do to deal with that.

    Possibly a bug I guess. It seems strange if it’s intentional to be inconsistent depending on where the upload comes from.
    If I change on line 5740 in class-wp-xmlrpc.php from $name to $upload[ ‘file’ ] the plugin works.

    Maybe the wp_handle_upload_prefilter hook is more appropriate?
    I am trying to get Imsanity to work with the WP Offload S3 plugin and they use wp_handle_upload_prefilter.

    @jason Thanks for a great plugin
    @oceanicsurfer Thanks for the mobile upload fix! I changed the line in the class-wp-xmlrpc.php file and the plugin works from the WP mobile app now!

    Did anyone create a trac ticket to see if this is a bug in core? Changing a core file isn’t a great long-term fix, although I definitely appreciate the solution.

    Jason

    (@verysimple)

    Hey @oceanicsurfer or @geckoblue4ever, was this in the function mw_newMediaObject ? The line numbers seem to be different on my version. It looks to me like this is the code that calls the hook in the version that I’m looking at:

    $struct = array(
    	'id'   => strval( $id ),
    	'file' => $name,
    	'url'  => $upload[ 'url' ],
    	'type' => $type
    );
    
    /** This filter is documented in wp-admin/includes/file.php */
    return apply_filters( 'wp_handle_upload', $struct, 'upload' );

    is that the same that you’re seeing?

    Yes that looks right 🙂

    I created this ticket: https://core.trac.wordpress.org/ticket/34165
    Would be nice if this was officially fixed.

    Jason

    (@verysimple)

    Great – thanks. Just to be clear, you fixed the line like this:

    $struct = array(
    	'id'   => strval( $id ),
    	'file' => $upload[ 'file' ], // <-- THIS IS THE CHANGE
    	'url'  => $upload[ 'url' ],
    	'type' => $type
    );
    
    /** This filter is documented in wp-admin/includes/file.php */
    return apply_filters( 'wp_handle_upload', $struct, 'upload' );
Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Images don't resize when uploaded via mobile device’ is closed to new replies.