how to store and retrieve images for user articles - asp.net

I have a web site in which users post news to site.
so i have two field in my database NewsTitle and NewsBody.
The Newsbody can have images.
What datatype should I use for NewsBody?
I don't want images loaded from image hosting site, I want images save in my database or in my web site's host.
What is the best way to implement this, should I use ajaxcontroltoolkit?
any ideas?

You can set your the datatype as varchar as the filename of your image, since all you need to know when you try to display the image is the filename. (but of course, you must already know the location of this file)

I think u can use ListView and the template field will contain asp:image.you can store the image name in the database and bind the imageUrl through the image directory in your system plus the image name.

Related

Get TinyMCE 4.3 Image Tools to save images as regular image files

The new TinyMCE 4.3 Image Tools (eg when cropping) saves images as blob data instead of image files in a directory. the edited mage url is like
blob:http://www.example.com/f2953aa1-e64f-49e1-a6e3-a283986663bf
I want to upload the image file to a specific folder and then use it as regular image referance / path.
Note
The question I am going to put is similar to Image edit issue. but the answer to this question is not working. I also tried http://archive.tinymce.com/forum/viewtopic.php?id=35740 solution but not working because it produces always same name image name.
The basic process is that TinyMCE will create a separate HTTP POST for each image that you modify with the image editor. It will send that image to a URL of your choosing (via HTTP POST) based on the setting of the images_upload_url option in your init.
The image handler at the URL referenced in the images_upload_url (which you have to create) has to do whatever needs to be done to "store" the image in your application. That could mean something like:
Store the item in a folder on your web server
Store the item in a database
Store the item in an asset management system
...regardless of where you choose to store the image your image handler needs to return a single line of JSON telling TinyMCE the new location of the image. As referenced in the TinyMCE documentation this might look like:
{ location : '/uploaded/image/path/image.png' }
TinyMCE will then update the image's src attribute to the value you return. If you use the images_upload_base_path setting in the init that will be prepended to the returned location. The TinyMCE page has more details on all of this:
https://www.tinymce.com/docs/advanced/handle-async-image-uploads/
The net here is that TinyMCE knows when an embedded image exists in your content but it can't possibly know what to do with that image in the context of your application so that job (the "image handler") is something you must create.

How to show image from the oracle database in asp.net

Hi there i need to show an image stored in the oracle database in (blob format i think).i have retrieved the image from database in dataset = dt.rows[0]["image"].how can convert the image to show it on the page.
Thanks.
In order to display it on a page, you need to serve the image as a separate resource from the web server.
Meaning, your page.aspx will have a tag with a src="your_image.aspx". In your_image.aspx, you need to clear response headers, make sure the Content-type is set correctly (image/jpg or something similar), put the contents of dt.rows[0]["image"] into a byte array and then write it out the binary image with something like Response.BinaryWrite(yourByteArray).
This is just a general outline. Use the googles for details :)

How to Display Uploaded Image from File System

I'm attempting to modify an inherited project that has a convoluted process of displaying uploaded images using an ImageMap control.
The current process inserts a new database record with image file name as well as model number and part number. The image files are saved to a virtual directory visible to IIS. Each part number has a corresponding .htm file containing an image map referencing the uploaded image. The image map has to be sized for each part and saved in the file system.
How can I streamline this process using either client side or server side controls? I'd like to bypass use of image maps as they require manual sizing. Can a control be used that auto sizes the image? Should the images be stored inside the database or kept in the file system?
Thanks for your advice;)
Storing the images in the database is IMHO a much more scalable solution.
Take a look at the Image Resizer project and its associated plugins for a way to resize the images, regardless of where you store them:
http://imageresizing.net/
http://weblogs.asp.net/bleroy/archive/2011/10/22/state-of-net-image-resizing-how-does-imageresizer-do.aspx
http://nathanaeljones.com/163/20-image-resizing-pitfalls/
You could use regular ASP.NET controls to display the images, for example, a ListView.

Wordpress image name same as page

Friends, i'm stuccoed with images in wordpress - please, help me understand where search for solution.
If you create webpage - www.wordpress.local/page1/01-0001 and you upload an image 01-0001 on that page, you can see, that when you'll visit www.wordpress.local/page1/01-0001, you'll see the page with image, not the page, that you created with text and images.
Any ideas how to solve it ?
PS Not renaming images :)
When you use the WordPress-uploader, the images are stored in /wp-content/uploads/, and WordPress takes care of using filenames that aren't already in use.
If you upload an image, e.g. via FTP, that has the same name as a WordPress-page, the server has to decide what it should serve; either the WordPress-page or the image. One URL = one file served.
In your case, the server decides for the image. You could of course change this configuration; but in all cases, one of the two files won't be accessible.
If you want to make both files accessible, you either need to rename the image or the WordPress-page.

categorize uploaded files

I have a webapplication for uploading and showing files(Image and video).The administrator can upload files and the users can view this files.Now i am inserting the details of file to the sqlserver and populating links for the corresponding file in the user's form.There may have images and videos.
I want to categorize the image and
video files;ie ,i want to show files
in two separate folders(Images and
Videos)
.This Categorizing also in sql(there should have a category table and it should be related with fileM table.
If anyone can help me please..
thank you
You need to detect the mime type of the file. Have a look at this question in stackoverflow..
How should I detect the MIME type of an uploaded file in ASP.NET?

Resources