Support » Plugin: Imsanity » [Plugin: Imsanity] Is the XMLRPC supported?

  • Hello,
    We use the 2.1.3 version of Imsanity on a multisite and are very happy with it. 🙂
    Still, another user mentioned that:

    the plugin will break the XMLRPC photo upload (or attachment to the post).
    it’s not possible to use pictures trough XMLRPC (Ipad/Iphone/Android wordpress App or Windows Live Writer).

    Is this true? If not could you please see into this?

    Thank you in advance,

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Jason


    As far as an error, no I don’t think imsanity is the cause because it isn’t even being loaded when uploading via RPC. I can upload images from my iPhone that exceed the limitations set in Imsanity. I haven’t been able to reproduce the error that was mentioned in the other post.

    My first guess is that plugins may not be loaded by RPC (or perhaps they require some special configuration) Though I dont know very much about the mechanics of WordPress RPC implementation. If anybody has more information I’d be glad to take a look.

    I have alerted the user who experienced the issues. He will most likely join us later with more details.

    Hi Marikamitsos,

    I read your post on WPMU. Let me activate the plugin on my live website and re-test this.


    That was a quick test.

    After activating the plugin on my WPMU site (3.1). I opened the android wordpress app and created a new post with an image in it.

    When I press publish on the app the post is publish but the app gives the following error:

    org.xmlpull.v1.xmlpullparserException: PI must not start with xml (position: unknown ize(wpid-1331591232.jpg): failed to open stream: no such file or directory in /home/g/public_site/wp-content/imsanity/imsanity.php on line 96 @ 2:5 in InputStreamReader@4050bd58)

    Hope you can fix this, if there is anything I can do let me know. I really love your plugin!


    I was checking the code and thinking about a fix. But perhaps the easiest fix would be to not resize pictures uploaded through a mobile app. Because the mobile app will doe the resizing of the pictures before sending.

    Let me know what you think.

    Plugin Contributor Jason


    Well I don’t have android to test but here is what happens on the iPhone – I’m assuming they use the same RPC methods:

    1. Imsanity enabled – does nothing regardless of the image size uploaded (ie the user can upload images larger than the imsanity limit size) I configured Imsanity with a really small size to make sure it would “catch” all images.

    2. Whether Imsanity is enabled or not – when I try to upload “original” size image I get an error with no details. The small, medium, large images (which are resized on the phone) will always upload with no problems, but not the original size (even though it is not much bigger than the large size)

    So in summary, basically what I see on the iPhone is that a) Imsanity simply isn’t doing anything at all and b) uploading the original size image will fail regardless of whether Imsanity is enabled or not.

    At the moment I’m pretty much out of ideas because it looks like the plugin isn’t even activated via RPC so I don’t know why android is getting an error & I don’t have an android to test.

    Oke.. Strange thing..

    So I started looking in the code and the error and added one check to the plugin. At this point the Android WordPress App is working.

    I changed the following two lines in imsanity.php.

    • added && file_exists($oldPath) to the if on line 87
    • moved line 89 $oldPath = $params[‘file’]; to line 85

    The code around line 88 looks like this:

    // make sure this is a type of image that we want to convert
    $oldPath = $params[‘file’];

    if ( (!is_wp_error($params)) && file_exists($oldPath) && in_array($params[‘type’], array(‘image/png’,’image/gif’,’image/jpeg’)))

    // figure out where the upload is coming from
    $source = imsanity_get_source();

    The only thing I added is checking if the oldpath image exists, if not then do not resize.

    Could you check this code and test it on your Apple.

    Hope it helps,

    Plugin Contributor Jason


    Thanks Pieter, I just added that in with a thank-you to you in the changelog.

    That strikes me as a bug with WordPress RPC because it’s very strange that the plugin would be fired and given file parameters, but the file doesn’t exist! I have a horrible work deadline but once I get some spare time I’m going to look into that and see if a bug report needs to be filed with WordPress

    Happy to help! Love your plugin, I disabled Resize at upload and network enabled your plugin for the 2000+ blogs on my network :D. This will be a good test for the fix :-).


    Plugin Contributor Jason


    Excellent – that’s a pretty big community!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Imsanity] Is the XMLRPC supported?’ is closed to new replies.