Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
sam123  
#1 Posted : Tuesday, February 1, 2011 9:35:44 PM(UTC)
sam123

Rank: Member

Groups: Member
Joined: 1/30/2011(UTC)
Posts: 16

Thanks: 4 times
Hello,

i need to set :
Image's minimun width/height be 320x240 if its portrait and 240x320 if its landscape.
Image's maximum width/height be 1024x768if its portrait and 768x1024 if its landscape.


is it's possible to not let them appear on the folder pane? means that they are not allowed to upload.
Dmitry.Obukhov  
#2 Posted : Wednesday, February 2, 2011 2:38:55 AM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Hi,

Here is the code snippet illustrates the sample how to prevent adding images, which are not satisfied to specified sizes:
Code:
function Count() {
            var imageUploader = $au.uploader('Uploader1');
            var count = imageUploader.files().count();
            for (i = count; i > 0; i--) {
                var width = imageUploader.files().get(i - 1).width();
                var height = imageUploader.files().get(i - 1).height();
                var name = imageUploader.files().get(i - 1).name();
                if (width / height < 0.75 && height > 320 && height < 1024) {
                    alert("The image " + name + " is more than 768x1024 or less than 240x320");
                    imageUploader.files().remove(i - 1);
                }
                else if (height / width < 0.75 && width > 320 && width < 1024) {
                    alert("The image " + name + " is more than 1024x768 or less than 320x1024");
                    imageUploader.files().remove(i - 1);
                }
            }
        }
    </script>

    <form id="form1" runat="server">
    <div>
        <cc1:Uploader ID="Uploader1" runat="server" Height="400" Width="900" AutoSave="true"
            DestinationFolder="Uploaded">
            <ClientEvents>
                <cc1:ClientEvent EventName="UploadFileCountChange" HandlerName="Count" />
            </ClientEvents>
        </cc1:Uploader>
    </div>
    </form>
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
thanks 1 user thanked Dmitry.Obukhov for this useful post.
sam123 on 2/2/2011(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.