How to upload images/photos efficently?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Is there an easy way to upload images/photos from camera/file and compress them before uploading. New phones create big images that will quickly use up available space and require long transfer time. The JIC project https://github.com/brunobar79/J-I-C seems to adress this, demo http://makeitsolutions.com/labs/jic/. Is it possible to combine with the file upload component in SKUID in an easy way. Either by specifying fixed value for ratio or by adjusting that as a property on the component.
Photo of Peter Baeza

Peter Baeza

  • 2,868 Points 2k badge 2x thumb

Posted 5 years ago

  • 1
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Hi Peter, I actually did this for a project I was working on. I used jCrop to let the user crop their photo, and then I forced the image down to a certain size using a html canvas element in a similar fashion to JIC. I had to write my own javascript remoting method in a custom controller extension to do the actual upload though. We really want to add this functionality to the image upload component, but haven't gotten the time to do this yet. I would have to play with JIC a bit to see if it would work to use Skuid's upload functionality. Unfortunately, I'm not sure when I'll get a chance to look at that. This would be huge though if the image/file component came with something like this out of the box.
Photo of Gregg Baxter

Gregg Baxter, Official Rep

  • 3,080 Points 3k badge 2x thumb
Hi Guys.  

I was looking for info on camera usage within Skuid mobile and I discovered this post.  

Do you know of any Javascript I can use in Skuid mobile to invoke the camera and save the image to a field or Google Drive link?

In SF1 you can upload a picture to SF files and include a WhoId but not a WhatId and the architecture to us is just not right.

Any help will be much appreciated.

:-)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
We have been able to upload images from devices to the Salesforce Attachment object.  If you are in the mobile builder and you use a "field" component on the reference to Attachment, you can use the "file upload" renderer.  On a mobile device you will be asked whether you want to upload somthing from your library,  or use your camera to take a new piclture. 

Then you can use the "image" component to display the uploaded file within your pages. 

The attachment object carries a parent object that ties it pretty effectively to the object you are trying to relate it too. 

I've noted that we need to better document this feature in our Mobile tutorials. 
Photo of Gregg Baxter

Gregg Baxter, Official Rep

  • 3,080 Points 3k badge 2x thumb
Hi Rob.

Thanks for this.  Can you check this for me please?

I have my main model.
I am using a look up to file for the image attachment.
I have a second model pointing to the Attachment Object and filtered to the record Id of the main.

Which field from the Attachment Object do I assign to the Field Component of the Deck pointing to the Attachment Object?

I have tried all and none give me the option to select "file upload" renderer.

Thanks G.
(Edited)
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Hi Gregg,

If you just want to upload the image (an not necessarily show it) you don't need a second model at all.  Once you've created your lookup to the Skuid File Object, you should just be able to add that lookup relationship as a Field Component.  On that field, you should have the option of the "File Upload" renderer.
Photo of Gregg Baxter

Gregg Baxter, Official Rep

  • 3,080 Points 3k badge 2x thumb
Thanks Ben.  

That works.  My problem here is I am using a Samsung Galaxy Note 3 and it reacts by creating a blank popup.  On the Galaxy Tab 10 '2014 it invokes a popup with the options to upload or remove the current file but does not invoke the camera option.  I am going to test on the new iPhone and will update this slot with the results.

Merci
G