Last post Dec 07, 2010 01:01 AM by kratos_vimal
Dec 05, 2010 01:54 AM|chuckdawit|LINK
I have a simple store that I have created following the book "Pro ASP.Net MVC 2 Framework" and in this book there is one table in the db: product.
This table hold the product data (id, name, price, category, image)
There is a sqlrepository that returns a linq table object in the sqlrepository constructor like this:
private Table<Product> productsTable;
public SqlProductsRepository(string connectionString)
productsTable = (new DataContext(connectionString)).GetTable<Product>();
Dec 05, 2010 06:57 AM|DigiMortal|LINK
Well... dragging thumbnails through all requests where products information is needed may cause performance losses. Keep images in separate table or better yet - keep them on hard disc.
Dec 06, 2010 03:09 AM|chuckdawit|LINK
So if I currently have one table called products with the columns id, name, price, category, description, image, mimetype.
Where image is the actual image, should I change this so that image is just the path to the actual image on disk?
Also if I create a thumbnail of the image, what is the best way to handle this?
Should I create the thumbnail when the admin first loads the picture and then save it on disk next to the full size image and create a new column in the product table and call it thumbnail and have it contain the thumbnail location on disk?
Last question - where on the disk is the recommended place to put images for a site? Is there some special folder that IIS will be better at retrieving pics?
Dec 06, 2010 03:17 AM|kratos_vimal|LINK
to your last question It should be inside your root folder coz else you won't be able to read or write into it
Secondly it's always better to store two versions one thumbnail path and the other full path it makes retrieval easier but saving longer
To get around it you can start a thread that picks up the image from the folder via there path from database and resize it at server and mark a flag against it in db
Don't forget to mark as answer if it helps
Dec 06, 2010 05:38 AM|DigiMortal|LINK
Dec 06, 2010 11:34 AM|chuckdawit|LINK
Where/which is the root folder for a ASP site?
Can you give me an example of what the directory would look like and how I would reference it in the code?
Dec 06, 2010 11:53 AM|kratos_vimal|LINK
You create a folder in the same folder which your code is there coz thats the only folder your virtual directory can access and manipulate.
Dec 06, 2010 02:40 PM|chuckdawit|LINK
If I create a folder where my code is, what path do I use to reference it?
What would the path look like in the table column?
Dec 06, 2010 05:30 PM|chuckdawit|LINK
I'm kinda a newbie to ASP MVC and I have a simple store that has a product table in the database that stores an image path and a thumbnail path.
Q1. How/where would I create the folder to put these images (ex. images/fullsize and images/thumbnail) in my VS2010 solution folder? I have four folders in the solution folder, a unit test folder, a domain folder,a webUi folder and a external assemblies
I was told that I should put them into the virtual directory, but I thought that was only created when I deploy the site?
Q2. If I create a folder with images in the solution folder how do I manage it with SVN if there are shit loads of pics? I don't want to be checking in and out lots of pics as I develop this and add more pics to it.
Q3. Once I have the folders created to store the pics and thumbnails for my online store, what should the path look like in the db (Sql Server 2008) column? Should it relative or is there another format?
Dec 07, 2010 01:01 AM|kratos_vimal|LINK
Answer1. Create another Folder in the webUi folder with the name Images
when you will publish yor site this folder will be automatically created, and you can depoly your published code then.
Answer2. it is better to commit and update with svn then make your database heavy and slow
Answer3.before you upload the images to the folder Add a unique id to the name of the image and store this name in the database column like ImageName and when you want to retrieve this image just fetch the name and add the path to fetch the image