c# - Storing and displaying images on a ASP.NET Webforms website with back end SQL database -
i building website using asp.net. site contains information 571 houses. each house has 10 images associated it, 1 main , 9 others. want able store these images in folder , set path them in sql database. site has on 100 pages of houses 5 results per page when click on house want know house have clicked , display images specific house. using 1 aspx page repeater control way don't have multiple aspx pages , houses displayed , filtered using pagination. main thing want find out how store , display these images using sql database. there on 5000 images, 10 per house.
in sql database should have called primary key
.
probably, integer (it should so).
you can create folder (e.g. content/housephotos/
) , create subfolder each house.
for example, house #713 photos stored in:
/content/housephotos/713/1.png /content/housephotos/713/2.png /content/housephotos/713/3.png /content/housephotos/713/4.png /content/housephotos/713/5.png /content/housephotos/713/6.png /content/housephotos/713/7.png /content/housephotos/713/8.png /content/housephotos/713/9.png /content/housephotos/713/10.png
if use such directory structure,
first, can sure directories unique , existent.
second, pretty easy make crud operations on "houses".
create - create folder, copy photos in read - access direct url update - replace files delete - remove folder
third, there no need store images, pathes or other information in database.
fourth, able operate photos files. example, through ftp.
fifth, images can cached either server , client browser. decrease amount of traffic , speed of page loading.
Comments
Post a Comment