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

Notification

Icon
Error

Options
Go to last post Go to first unread
jneyens  
#1 Posted : Tuesday, December 11, 2012 6:15:52 AM(UTC)
jneyens

Rank: Member

Groups: Member
Joined: 7/12/2007(UTC)
Posts: 8

Thanks: 2 times
I am using Uploader Suite 8.0.8 using ASP.NET MVC 4. I am using the JavaScript API to add an uploader in my view:

Code:

<script type="text/javascript" src="/Assets/Scripts/ImageUploader/aurigma.uploader.js"></script>
<script type="text/javascript">
    var u = $au.uploader({
        id: 'Uploader1',
        width: '1180px',
        height: '480px',
        licenseKey: '@ViewBag.LicenseKey',
        converters: [{ mode: '*.*=SourceFile' }],
        javaControl: {
            codeBase: '/Assets/Scripts/ImageUploader/Uploader8.jar'
        },
        activeXControl: {
            codeBase: '/Assets/Scripts/ImageUploader/Uploader8.cab',
            codeBase64: '/Assets/Scripts/ImageUploader/Uploader8_x64.cab'
        },
        metadata: {
            cookie: 'ASP.NET_SessionId=@Session.SessionID;@FormsAuthentication.FormsCookieName=@Request.Cookies[FormsAuthentication.FormsCookieName].Value'
        },
        uploadSettings: {
            actionUrl: '@Url.Action("Upload", new { id = Model.ProductId })',
            redirectUrl: '@Url.Action("Index", new { id = Model.ProductId })'
        }
    });

    u.writeHtml();
</script>


In the Upload Action of my controller, I have something like this:

Code:

[HttpPost]
public ActionResult Upload(int id, FormCollection collection)
{
    var pictureSaver = new PictureSaver();

    for (int i = 0; i < Request.Files.Count; i++)
    {
        var httpPostedFileBase = Request.Files[i];
        if (httpPostedFileBase != null && httpPostedFileBase.ContentLength > 0)
        {
            pictureSaver.Save(httpPostedFileBase);
        }
    }

    return new EmptyResult();
}


This is all working fine, except for one thing: when I rotate images in the Uploader, they are not rotated after saving them. Is this because *.*=SourceFile is never rotated and I need to use an extra converter for that, or do I need to manually inspect the Angle_X POST-parameters and rotate the images myself?
p.shirykalova  
#2 Posted : Tuesday, December 11, 2012 7:33:27 PM(UTC)
p.shirykalova

Rank: Advanced Member

Groups: Member
Joined: 7/13/2011(UTC)
Posts: 286

Thanks: 6 times
Was thanked: 31 time(s) in 31 post(s)
Hi Kristof,

Yes, you are correct when thinking the problem is in converter settings.
Using SourceFile converter means uploading the image (or file in general) without any modifications. Rotating the image before upload modifies the file, but the converter knows it should upload the original one.
So, to be able to upload rotated images please use the following converter:
Code:
converters: [{mode: '*.*=Thumbnail; *.*=SourceFile', thumbnailFitMode: 'ActualSize'}]

With these settings you will get the image of original size, but with rotating applied. Note I used multiple masks in mode property to make single converter work with all file types - if the converter fails to generate a thumbnail for the file (say, you upload PDF) it sends source file.

Please learn more about uploading rotated images here.

Let me know if you have any additional questions.
Best regards,
Pauline Shirykalova
Aurigma Technical Support
thanks 1 user thanked p.shirykalova for this useful post.
jneyens on 12/11/2012(UTC)
jneyens  
#3 Posted : Tuesday, December 11, 2012 11:20:37 PM(UTC)
jneyens

Rank: Member

Groups: Member
Joined: 7/12/2007(UTC)
Posts: 8

Thanks: 2 times
Hi Pauline,

Thanks for clearing this up. Another quick question: I believe all images that are modified client-side (rotated, cropped, resized) before uploading are converted to the JPG format, right? So if a user selects a .png or a .gif file but rotates it before uploading, those files are actually transmitted as jpg files. Is that correct?
p.shirykalova  
#4 Posted : Tuesday, December 11, 2012 11:25:11 PM(UTC)
p.shirykalova

Rank: Advanced Member

Groups: Member
Joined: 7/13/2011(UTC)
Posts: 286

Thanks: 6 times
Was thanked: 31 time(s) in 31 post(s)
Yes, that is correct. If uploader creates a thumbnail for the image, the results would be in JPEG.
Best regards,
Pauline Shirykalova
Aurigma Technical Support
thanks 1 user thanked p.shirykalova for this useful post.
jneyens on 12/11/2012(UTC)
Users browsing this topic
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.