best way to display images android? - c#

I am developing an android application and I have to display images in it. This image is uploaded from a c# application and I need to retrieve it to android client.
I am trying by loading the image into the DataBase and retrieveing it from android, but this takes much memory and I need a better way to do it.
This c# application is allocated into the server so maybe a good way is to store the images and access to the path from the android client, but is it possible to public an image in my server?
Further, which one you think is the best way to do it?
Thank you.

If I understand you correctly: You upload a picture using a C# program which stores the image (as binary data) in the database?
I would recommend to store the image on the filesystem and the (relative) path to the image in the database. Your Android clients get the URL of the picture and can download and display the image.
There are (very good) Android libraries for displaying images from URLs. Take a look at this library: Android-Universal-Image-Loader.

I will recommend you to store image file to server, and add its path to database.
The easiest ways to display image in your android app is using Picasso Library.
Download Picasso library from here
Add it to your build path. Import this library to your code file.
For loading image from web url:
String url = "http://example.com/image.png"
Picasso.with(getApplicationContext()).load(url).into(imageView);
For loading image from drawable:
Picasso.with(getApplicationContext()).load(R.drawable.imageFile).into(imageView);
Here, imageView is the name of variable you are using to represent ImageView. Eg.
ImageView imageView = (ImageView) findViewById(R.id.ImageView1);
To use Picasso with ImageButton, change imageView variable to imageButton variable
ImageButton imageButton = (ImageButton)findViewById(R.id.imageButton);

Related

Svg files to display in Android

I have a large number of svg files (over 1000) that have keyframe animations included in the CSS. Ultimately I want to be able to display these in an android app.
I looked into using android vectordrawable among other solutions but that will only display the image from path data and wont be feasible to try add animations to every file.
I have have also tried converting to png using http://www.codeplex.com/svg in c#, again the png file does not include the animation.
You can use a Webview to display your svg.
here is a post that can help .svg file as object in HTML

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
.

Load external images efficiency

I would like to know a most efficient way to load external images to my website.
For example:
My website's url is "www.mydomain.com". The external image is http://www.myimagedomain.com/image.jpg.
The most common way is to write a simple html image-tag like
<img src="http://www.myimagedomain.com/image.jpg" />.
The problem is, if the requested image is very large (8000x6000 pixel) but I want to show this picture as a thumbnail/preview like 200x200 pixel, e.g on mobile devices.
Based on this information I wrote a little ashx (c#) handler that downloads the requested image and resizes it to a given weight/height parameters, like this:
<img src="http://www.mydomain.com/img.ashx?imageUrl=http://www.myimagedomain.com/image.jpg&w=200&h=200" />
Now there is another problem, because the httphandler always downloads the requested image, on-the-fly.
My new approach is to generate a based64 string from the resized image and save this in a database once?!
Would you recommend this or is there another way to eliminated the download problem?
Maybe someone know how google-image-search prevents this problem?
I don't want to save the external images on my own server...
I would suggest to use image resizer library, it solves much of what you need in efficient way - caching included:
http://www.nuget.org/packages/ImageResizer/
I think google caches image thumbnails on its servers for search.

Draw image from swf with C# graphic

I have swf file's that's contains 2D images (here one of them: http://mapviewer.ru/img/tramvay/depo_d.swf )
I need draw this image (like seen in my browser), to bitmap.
Maybe i need convert this file to image (png, jpg)? No matter how, but it should be done programmatically.
Updated
Have you tried to look at this library ?
There are no embedded images inside the SWF file, only Vector shapes, which means you would need to both parse the SWF and render the data that is inside, so taking a screenshot of it is probably your best option. There are a lot of ways of doing this, but you could simply load the Flash Active-x in your application and take a screenshot. Here's how to load the SWF : Displaying Flash content in a C# WinForms application

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.

Categories

Resources