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).
Related
I have images stored in a SQL Server database with datatype image. I want to retrieve them and convert them to bitmap, and use them to create an asp.net web form image gallery for an online shopping web site.
Should I use <asp:Repeater> control, <asp:GridView> or data list control?
I don't want to use image path stored in the database
It's sad that the experts here are asking you questions as if you already know how to solve your problem which it is clear from your question you don't. Let me try and give you a little background and direction and I think you will be able to get closer to solving what you want to do.
Your images are just blobs in your sqlserver database which has no direct connection the web. The only way you can show images is you need to basically put them into an img tag with src= the location on your web server. What needs to happen is the location on the web server you choose must instead of reading a file from the file system of the server, must somehow grab the image from the database and then stream those image bytes to the img tag on the page.
THere are multiple ways to do that in asp.net. The easiest is a handler or ashx file (don't even know if those are supported anymore).
At anyrate, here is a link that might help. You might try googling something like "display image from sql server on asp.net" and see what else comes out. Obviously, lot's of people do this and you will to soon.
Good Luck.
https://www.aspsnippets.com/Articles/Display-image-from-database-in-Image-control-without-using-Generic-Handler-in-ASPNet.aspx
Hi I'm fairly new to Kentico. I need to access the CMS and get images to my html page. how do i do that, have seen methods like getURL, but dont know which context i use them
If the places where you enter content on the page are rich text, meaning you type in them and a toolbar appears which allows you to format text & do other stuff, then there is an icon that looks like a film strip, click that and you should be able to select an image from the media library.
or
If there is nowhere to do that, then click on the Design view and add an editable image web part to the page template.
Can you elaborate on what you mean by HTML page?
Are you using the portal engine to design your page? if so, you can add the image using a static html web part, and just add the url to the file, getting the url depends on where it is stored. is it an Attachment? In a Media Library? In your App Themes?
-UPDATE-
Since you are storing your files in the Media Library, there are a couple ways to display the image on the page.
Static HTML - You can go to the page, design tab, add a static html web part, in that webpart add the HTML for the image. Something like To get the URL, you can go to the media library, and select the image you want, and in the panel at the bottom it should have the URL for the image.
Add the Editable Image Web Part to the page, you can then set the default image in the web part properties, and using those dialogs you should be able to select the file from the media library. Additionally, once the web part is on the page, you should be able to switch to the page tab, and select the image you want there.
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
.
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.
I want to upload an image and want to show a particular part of image in the thumbnail of particular size. I want to customize the thumbnail look.
I think it is a combination of an ASPX page, some jQuery plugin like Image Crop (http://www.webresourcesdepot.com/jquery-image-crop-plugin-jcrop/) and a handler which accepts the changes made to the image using an AJAX call.
I think it would be pretty easy as long as the jQuery plugin supports the right events. Jcrop supports an onChange event, which you could use to send certain coordinates to a handler.
Edit: Someone already did this and wrote about it: http://www.omerfarukzorlu.com/post/ASPNET-Image-Croper-Component-with-JCrop.aspx
PS. Not sure about the downvoting. It is a new user, but StackOverflow does not supply complete solutions for most cases, but just tips and pointers to find the solution yourself.