How to display an image from URL in Image component in Appery - image

I need to display an image using a URL that I receive from Push Notification. I tried many docs and blogs but couldn't find the correct solution. I don't want to download and store in DB.

the easiest way that i found to do this...
map the url to an image box and make it visible, set an events event to success, set action to Set property, set component name to what you want to show the image, set property to visibile and value to true leave check box empty as in this image success to html function

Related

How to get LabelActionData of a Label

I'm trying to see how to get Labels that does not have any action data for encryption. I see in the SDK it lists LabelActionData as a class, but I can't see anything in the Labels themselves that lets me get the ActionData of that label. Is there anyway to get it via fileEngine to get the labelActionData of each label after getting all the labels with listLabels?

dropzone.js - how to control where thumbnails appear

I have a nice drop down area, but if I set that to class"dropzone" then the form elements are not sent.
If I add class"dropzone" to the form, then the form elements are sent, but the thumbnails appear under the form, the submit button, etc.
How please do I tell dropzone to use my template at id "#dropzone_thumbs_here" or class ".dropzone_thumbs_here". Do I have to fully write my own thumbnail handler? Or send form details separately? Or is there a better method !!
Sorry, I missed the answer because in the documentation it was under tips and not configuration.
In the config parameters, just added:
previewsContainer: "#myPreviewContainerID",

Need a non-ugly way to dynamically modify acceptFiles and allowedExtensions

I have an uploader that has two modes where it uploads different file types. Which one is active depends on what the user is doing. I am using FineUploaderBasic.
Right now to dynamically modify the allowedExtensions I do something like this:
if(type==<?=Campaign_Placement::AD_TYPE_USER_FLASH?>) // SWF
uploader._options.validation.allowedExtensions = ['swf'];
else // Static image
uploader._options.validation.allowedExtensions = ['jpeg', 'jpg', 'gif', 'png'];
uploader.reset(); // Resets with the new extensions
And to modify the acceptFiles:
if(type==<?=Campaign_Placement::AD_TYPE_USER_FLASH?>) // SWF
$('input[name="userfile"]').attr("accept", "application/x-shockwave-flash");
else // Static image
$('input[name="userfile"]').attr("accept", "image/jpeg, image/jpg, image/gif, image/png");
Both are ugly ways to do this, would appreciate a simple way to do both of these through the API, or some other elegant solution. Thanks!
You have 3 other options to solve this problem:
Don't set the allowedExtensions validation value at all. Then contribute a validate event handler that returns false if the user has submitted an invalid file, based on the value of the select you have provided.
Simply construct or re-construct the uploader instance whenever the user changes their selection.
Consider using the relatively new extraButtons feature, where you can connect additional upload buttons to a single Fine Uploader with varying validation options. For example, you can contribute some default allowed extensions (tied to the default upload button), and then provide an extraButtons button with alternate allowedExtensions. Simply display the appropriate button via JavaScript when the user changes their selection.

ajax function which uploads the image and preview it with another string from server

I want to use file upload control to upload an image and preview it in same page without submitting the form, is this possible?
if possible, please let me know how to set the query string of the ajax function, and how to handle that query string at server side. I am using jsp or servlet.
Intention is to send the image through ajax function call, where I can store the image in server's local folder. also the form will be updated with the part of the result string which is some other component output. Along with this I can show the image which user uploaded.
1. upload the image through ajax call.
2. return string is do two things, one for shows the image in respective place holder by servers local path and another is to get the other component output which is a string.
3. if i have that string, I am manipulate at call back function to set the values.
4. after enters users data I want to submit the form finally.
I tried it, but failing to send the file object as parameter to the servlet or jsp. Also if we can send that object, how can we handle that object at jsp?

Uploading single image and showing its thumbnail using jquery and asp.net mvc3

I need to upload the photo of a user with his details from asp.net mvc3 razor view. The image selected by the user has to be shown as thumbnail before submitting the form.
The model of the view contains a byte array property called Photo. On page load i am converting this byte array to base 64 string and showing it in . this is working properly .
Now i need to show the thumbnail of the image selected by the user. And when he clicks on submit button i need to bind the selected image to the model property Photo.
After googling , i came to know that showing thumbnail is not possible until I upload that image. I tried Uploadify but its UI behavior is not what i am expecting. I also tried the article http://www.dustinhorne.com/post/2011/11/16/AJAX-File-Uploads-with-jQuery-and-MVC-3.aspx, but it is also not suitable in our scenario.
can anyone help me by sharing their experience achieving this scenario.
Thanks in advance.
You could achieve this using HTML5 File API. Take a look at the following article and more specifically the Showing thumbnails of user-selected images section which illustrates an example of how you could achieve that without uploading the image to the server.
And if you want to support legacy browsers that do not yet support the HTML5 File API you could use the jQuery.form plugin which allows you to easily send the contents of a given form to the server using AJAX and it also supports file uploads. So basically you could subscribe to the .change() event of the file input or the .click() event of some see thumbnail ... button and then submit the form to a controller action using AJAX:
$('#myform').ajaxSubmit({
url: '#Url.Action("thumbnail")',
success: function(result) {
// the result variable will contain the result of
// the execution of the Thumbnail action.
// could be a BASE64 encoded representation of
// the thumbnail you generated on the server and then
// simply set it to the src property of your preview `<img>`
// element using the Data Uri scheme
}
});

Resources