WordPress.org

Ready to get started?Download WordPress

Forums

Imsanity
[resolved] Imsanity and problem with Twentyten backgrounds (9 posts)

  1. janiu
    Member
    Posted 2 years ago #

    Hi,

    Thanks for the great plugin. It works perfectly on a multisite with hundreds of bloggers uploading huge images for their posts.

    But there's also one problem. We're using Twentyten theme and when uploading a background image for the theme Imsanity also resizes that. We want to allow background images to be 1800px wide but restrict images for posts to be 800px.

    Is it possible to modify the plugin so that it only resizes images uploaded while making a blog post?

    Thanks!

    http://wordpress.org/extend/plugins/imsanity/

  2. Jason
    Member
    Plugin Author

    Posted 2 years ago #

    Hmm that's interesting. I'll have to see a couple of thing.

    First whether that information is even available within the function that Imanity hooks into. Surely it's available somewhere but within that function scope I don't know if the information is there as far as the source of the upload.

    The second thing I guess is how many unique places are there to upload files and how to identify them. I know of pages, posts and the media library. Anything else might be considered a "plugin"

    If I were to create a setting for "media library" and then a setting for "everything else" it could open up the possibility for large uploads if a plugin implements upload functionality. That probably does tend to be theme header images, logos, etc, but could be anything.

  3. janiu
    Member
    Posted 2 years ago #

    It would be a great solution to let the admin choose whether to resize:
    a) All uploads

    or only (with check boxes)
    b) Posts & Pages
    c) media library

    This way I could check b and c options and it would resize everything except the uploads by plugins and themes.

  4. Jason
    Member
    Plugin Author

    Posted 2 years ago #

    For the moment the best workaround is to either temporarily disable Imsanity or increase the limit so the header isn't scaled. The imsanity default is 1024x1024 so it shouldn't scale the Twentyten theme header image (1000x330). Setting the width/height to zero will also tell Imsanity not to resize.

    So far I've had no luck finding out where an upload originates at the level where Imsanity hooks into the process. I know it's possible to hook in at a later point but then WordPress has already done some voodoo (generated smaller images, inserted db records for those, etc). That means Imsanity would then have to inspect and undo things, remove files and db records. That makes things a bit more complicated.

    Considering there's a couple of workarounds I probably will keep this on the back burner. If some people can make a good case for it, I'll definitely be listening.

    I do have a support request here if anybody knows an answer - http://wordpress.stackexchange.com/questions/34428/how-to-find-the-origin-of-a-file-upload-from-within-wp-handle-upload

  5. janiu
    Member
    Posted 2 years ago #

    Thanks for trying! The problem is not actually the headers but the background images that might be around 1800px wide. Putting the Imsanity limit there is one option but that won't save so much space as preferred for the other images...

    I don't know the logic behind this so well, but could be possible somehow for the plugin to check from the url whether it should hook the uploading or not?

    Jani

  6. Jason
    Member
    Plugin Author

    Posted 2 years ago #

    That's not a bad idea. Though it's not really the "WordPress way" since they don't offer any api calls to get that info (that I know of) and there's no guarantees about filenames or querystrings remaining unchanged. I'll check it out, though.

  7. Jason
    Member
    Plugin Author

    Posted 2 years ago #

    i figured out a way to make it work. I just released version 2.1.0 and you can set different sizes for the images by post, library or "other"

  8. janiu
    Member
    Posted 2 years ago #

    You're great! It's working, now I can let the users add larger backgrounds but restrict the original image sizes in posts.

    Thanks!!

  9. Jason
    Member
    Plugin Author

    Posted 2 years ago #

    awesome! there is a small chance it could change in a future wordpress release if they change the form parameters, since there was no api to use. but worst-case scenario it will just fall back to the "other" setting for all images.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags