Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kenny Burns 173 posts 305 karma points
    Feb 07, 2012 @ 16:12
    Kenny Burns
    0

    Resizing Smaller Images

    Hi,

    First of all, this is a fantastic package and something that is very useful! Great work guys!!

    I have one query at this point, that i am hoping you can help me with. In the user control we have set the max size kb to 1 and the longest side to 800. We have hidden the textfields.

    This means when a user uploads an image it will resize the image to 800px all the time. Is there a way to stop it doing this if no sides are smaller than the 800px. e.g if the user uploads an image 400 x 300px it won't do any resizing. Its more the dimensions than physical byte size that is causing some problems when we combine this with say the image cropper.

    Thanks in advance for any help!

    Kenny

  • Kenny Burns 173 posts 305 karma points
    Feb 07, 2012 @ 16:36
    Kenny Burns
    0

    Hi,

    Just to say i found a workaround - i inserted a little bit of jQuery in the user control that will check if the longest side is larger than the specified one. I have pasted code below in case anyone else needs it.

    Kenny

     

    function updateData() {

                var vsize = $('#TBSize').val();
                var vdim = $('#TBDim').val();
                var vcomp = $('#DDComp').val();

     

     

                // added by KB: 07/02/2012

                var kWidth = $('#file_upload').width();
                var kHeight = $('#file_upload').height();

                          

                if (kWidth > vsize || kHeight > vsize) {
                     //do nothing
                  }

                else {
                if(kWidth > kHeight){
                      vsize = kWidth;
                  }

                      else{
                      vsize = kHeight;
                      }
              }

              // end added code

                $('#file_upload').uploadifySettings('scriptData', { 'wsize': vsize });      
                $('#file_upload').uploadifySettings('scriptData', { 'wdim': vdim });
                $('#file_upload').uploadifySettings('scriptData', { 'wcomp': vcomp });

            }

  • Ernst Utvik 123 posts 235 karma points
    Feb 07, 2012 @ 21:37
    Ernst Utvik
    0

    Hi Kenny,

    Glad to see that someone else found a use for it :) Next version should probably have a "don't upscale" checkbox. Until then, js hacks ftw ;)

    I just uploaded the latest version of the source code (0.5) if anyone is interested.

    Ernst

  • Kenny Burns 173 posts 305 karma points
    Jun 28, 2012 @ 18:28
    Kenny Burns
    0

    Hi Ernst,

    That code i posted above....yeah that doesn't work!! It all looked grand, but after some further tetsing, it definately doesnt work! Oops!

    That "dont upscale" thing - would that be something thats easy to do?

    Kenny

  • Ernst Utvik 123 posts 235 karma points
    Jun 28, 2012 @ 21:04
    Ernst Utvik
    0

    Hi

    I have a half done version with an don't upscale checkbox. Going to have a play with it tonight and see if I can get it ready. Also fixes the w/h thumbnail ratio bug on taller images.

    Teaser image ;)

  • Ernst Utvik 123 posts 235 karma points
    Jun 28, 2012 @ 23:33
    Ernst Utvik
    1

    Hi again Kenny. DM me your email on twitter (eoutvik) and I'll send you the updated files for this. Have done some testing on a dev site and seems to be working as intended. Wont release as package before handeling of filetypes other than images is implemented.

    Ernst

  • Kenny Burns 173 posts 305 karma points
    Jun 30, 2012 @ 13:12
    Kenny Burns
    0

    Hi Ernst,

    Sent you a DM on twitter. Thanks for this - i will give it a test and let you know how i get on!

    Cheers! :)

    K

Please Sign in or register to post replies

Write your reply to:

Draft