Display Chosen Image From FileUpload before upload - c#

I'm using the control FileUpload to choose an image and upload but now I want to display a preview of the chosen image before saving the image, just to give the user an output of the chosen image.
I googled but could not find an answer for that.

The problem is you have to upload the image to your server to you can display(serve) it.
I did some searching, and found this question: How to show local picture in web page? - and I was thinking, if you have the local path of the image, why not use some ajax to pop the url in a simple img tag.
However, you can't even link to a local image anymore, due to security. So for your application to show a preview of the image you would have to first have the image to display it, and the upload would have to occur first.

Related

Preload image from URL for KenBurnsView Xamarin.Android

I am using https://components.xamarin.com/view/KenBurnsView
I have several image URL-s by which I want to show them via KenBurnsView
after setting src of KenBurnsView to the first imageURL, at the TransitionEnd I want to replace src with new image URL and restart animation, but I want the image to be preloaded to make everything smooth.
I would preload next image at the TransitionStart event so at the end image could be loaded, but I dont know how to do it.
Image caching is what I mean maybe but I dont know how to cache it very first time
For image caching you can do it yourself, saving the image in the FileSystem when downloaded from internet and next time you need to load the image you check if it's already local and if it's not you just hit the web and save it. There's of course a little more to do like deleting the images in file system after certain period but just wanted to give you the main idea.
For my projects I use this library FFImageLoading. It's well maintained and its use is so simple.
ImageService.Instance.LoadUrl(urlToImage).Into(_imageView);
When the image is loaded from internet the image is cached on disk (by default 30 days but there is an optional TimeSpan so you can choose yours).
Android documentation.

How to Extract Larger Images from an HTML Page to Make Thumbnails (Like Facebook Does)

In my application, I post articles and the entire document is stored as html in the database. In different places in the articles I use images. (By uploading it or just placing img urls).
On the homepage I want to make thumbnails of my desired size, so that I can place some recent articles along with their preview images there.
So, how can I extract larger images from any html document? (So that only relevant images are selected, not any other images)
And from the list of images, how to determine and select image which occurred at first?
I want to use that "one" image to make thumbnail programatically on the server. I
will cache it and then display it on the page.
Like a wordpress application or any other CMS does.
Currently, I use the following approach which is I think is not correct:
At the time of posting an article when I upload images in the editor, I keep the imageId of the of the last uploaded image and store it into the database along with the article. So I have a separate column for imageId for each article I post.
Problem starts when I do not upload any image, then I have to insert a default imageId automatically to avoid problems. This process is annoying. Please help me out. Please guide me the most practiced and the easiest solution available.
The site where I implement all this is http://disneyduniya.in
You can use demo of below code: Generate Web Page Thumbnail Screenshot Image:
Demo link Its working : http://pietschsoft.com/post/2008/07/C-Generate-WebPage-Thumbmail-Screenshot-Image
It will create image file ,save this file As and customize height and width
.

Showing thumbnail of Flash image using C#

I have a grid in my application where I show thumbnail (100*100) of images. I am using imageresizing.net plugin to generate thumbnails on the fly. My image URLS are coming from third party application. Sometimes instead of images I am getting a flash file (.SWF). The plugin is throwing ImageCorruptedException.
As of now, I am handling the exception in Application_Error of Global.asax and returning back a default image URL.
Now I want to show the thumbnail of flash image instead of default image. How can I achieve this in C#? I have searched a lot on Google but no convincing answers.

Image Quirk with PDF generated by WKHtmlToPDF

Using WKHtmlToPDF to generate PDFs for my company's web-based mapping service.
Essentially, I take a template HTML file, inject an image into a div, save the HTML to disk and use WKHtmlToPDF to render to PDF.
Now, on most templates it works a treat. On one particular one though, where the image should be (int the pdf) is a grey area. HOWEVER, if I right click on the grey area, and select "Save Image As...", the saved image is correct.
Linked are the created PDF and the HTML on which it is based. Help required most urgently, and hints appreciated.
Zip File Containing HTML and PDF
I was having an issue where a particular image was not being printed to the PDF. Other images on the same page were. The src of the missing image is from a CDN, but had no extension, i.e. src="\\path/to/image?param". Using the aforementioned -n switch (disable Javascript), the image shows up in the resulting PDF. Thanks Jordaan.
Don't know WHY this worked, but adding the "--disable-smart-shrinking" option, and/or removing the "-n"(Disable Javascript) option, fixed it.

Combining URL text box with FileUpload control

I'm developing a web app which allows users to upload images. Instead of forcing them to first download an image I also want to allow them to provide a URL of the image elsewhere on the web.
I've got the code to do this, my question is how can I combine these into one text box that will allow the user to enter either the location of the image on their hard drive or the location of the image on the web.
I'm aware of the ASP File Upload control - but how could I leverage it to do this?
Let them choose like you can here at StackOverflow? (try to add an image to an answer; you get the same option).

Categories

Resources