Design
-
Soooo, I have a little website that contains all my digital photos so that my family can see them without me having to constantly send images as email attachments. This works really well, as I am living in California and my family are in England and France - it really makes it easier to share the images. All I have to do is copy the contents of my digital camera into a folder on my server and the photos automatically appear on the web site. Family members have to login to see most of the images, and I've recently starting creating accounts for other people to be able to login and see photos they might be interested in. For example, my sons soccer team have an account, and they can only see soccer related images. Now, this is all working perfectly, so I decided to add a feature to allow people to leave comments on the images. So far, so good. The comments are stored in an XML file in the same folder as the image. So, for example image1.jpg might have an associated image1.xml file containng all the comments. I stored the comments in XML files instead of a database for several reasons:
- I can rename folders without breaking links to files in the database.
- When I archive folders onto CD, the comments will automatically be copied (and readable) without having to mess with a database export.
And now comes the great design shortcoming... I want to add a feature to the front page of the album that shows the last 5 comments added, with hyperlinks to the image. However, in order to do this, I will need to store the full path to the image somewhere, so that the hyperlink will work. I could create another XML file that gets updated whenever a comment is added, or I could just shove all the comments into a database and build my list from there - which would render my XML files rather pointless! :doh: Either way, I've just created a load of work for myself. If I had used a database from the beginning, then building the list of recent comments would be trivially easy, but I would lose the freedom of renaming folders and moving files. Without wishing to wander too far into "programming question" territory, what suggestions would you have for moving forward from here - XML index file or SQL Database or something else entirely?
-
Soooo, I have a little website that contains all my digital photos so that my family can see them without me having to constantly send images as email attachments. This works really well, as I am living in California and my family are in England and France - it really makes it easier to share the images. All I have to do is copy the contents of my digital camera into a folder on my server and the photos automatically appear on the web site. Family members have to login to see most of the images, and I've recently starting creating accounts for other people to be able to login and see photos they might be interested in. For example, my sons soccer team have an account, and they can only see soccer related images. Now, this is all working perfectly, so I decided to add a feature to allow people to leave comments on the images. So far, so good. The comments are stored in an XML file in the same folder as the image. So, for example image1.jpg might have an associated image1.xml file containng all the comments. I stored the comments in XML files instead of a database for several reasons:
- I can rename folders without breaking links to files in the database.
- When I archive folders onto CD, the comments will automatically be copied (and readable) without having to mess with a database export.
And now comes the great design shortcoming... I want to add a feature to the front page of the album that shows the last 5 comments added, with hyperlinks to the image. However, in order to do this, I will need to store the full path to the image somewhere, so that the hyperlink will work. I could create another XML file that gets updated whenever a comment is added, or I could just shove all the comments into a database and build my list from there - which would render my XML files rather pointless! :doh: Either way, I've just created a load of work for myself. If I had used a database from the beginning, then building the list of recent comments would be trivially easy, but I would lose the freedom of renaming folders and moving files. Without wishing to wander too far into "programming question" territory, what suggestions would you have for moving forward from here - XML index file or SQL Database or something else entirely?
-
Hmmm..personally I would have written it to store both the comments and the photos in a database but maybe that's just me. :)
"110%" - it's the new 70%
thats what i just told him ;)
"there is no spoon" {me}
-
thats what i just told him ;)
"there is no spoon" {me}
l a u r e n wrote:
thats what i just told him
Is Miszou your colleague then? He said CA and I believe you are somewhere there too.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
l a u r e n wrote:
thats what i just told him
Is Miszou your colleague then? He said CA and I believe you are somewhere there too.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linknoooooooooooo ... i dont even know him ... i just emailed him provately to go look at one of my personal websites that does something similar and gave some advice is all ;)
"there is no spoon" {me}
-
thats what i just told him ;)
"there is no spoon" {me}
-
I was going to say great minds think alike but you being a drummer and all... ;)
"110%" - it's the new 70%
:laugh:
"there is no spoon" {me}
-
I was going to say great minds think alike but you being a drummer and all... ;)
"110%" - it's the new 70%
John Cardinal wrote:
but you being a drummer and all...
and what is the matter with a drummer?? harumph!! ;P Actually, I have a drum, but have used it for maybe 30 minutes in the last 6 months.... Not your usual drum though....
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
Soooo, I have a little website that contains all my digital photos so that my family can see them without me having to constantly send images as email attachments. This works really well, as I am living in California and my family are in England and France - it really makes it easier to share the images. All I have to do is copy the contents of my digital camera into a folder on my server and the photos automatically appear on the web site. Family members have to login to see most of the images, and I've recently starting creating accounts for other people to be able to login and see photos they might be interested in. For example, my sons soccer team have an account, and they can only see soccer related images. Now, this is all working perfectly, so I decided to add a feature to allow people to leave comments on the images. So far, so good. The comments are stored in an XML file in the same folder as the image. So, for example image1.jpg might have an associated image1.xml file containng all the comments. I stored the comments in XML files instead of a database for several reasons:
- I can rename folders without breaking links to files in the database.
- When I archive folders onto CD, the comments will automatically be copied (and readable) without having to mess with a database export.
And now comes the great design shortcoming... I want to add a feature to the front page of the album that shows the last 5 comments added, with hyperlinks to the image. However, in order to do this, I will need to store the full path to the image somewhere, so that the hyperlink will work. I could create another XML file that gets updated whenever a comment is added, or I could just shove all the comments into a database and build my list from there - which would render my XML files rather pointless! :doh: Either way, I've just created a load of work for myself. If I had used a database from the beginning, then building the list of recent comments would be trivially easy, but I would lose the freedom of renaming folders and moving files. Without wishing to wander too far into "programming question" territory, what suggestions would you have for moving forward from here - XML index file or SQL Database or something else entirely?
Why not just use something like Picasa Web Albums (or Yahoo! Photos) - unless you especially want to program all this stuff?
Kevin
-
Soooo, I have a little website that contains all my digital photos so that my family can see them without me having to constantly send images as email attachments. This works really well, as I am living in California and my family are in England and France - it really makes it easier to share the images. All I have to do is copy the contents of my digital camera into a folder on my server and the photos automatically appear on the web site. Family members have to login to see most of the images, and I've recently starting creating accounts for other people to be able to login and see photos they might be interested in. For example, my sons soccer team have an account, and they can only see soccer related images. Now, this is all working perfectly, so I decided to add a feature to allow people to leave comments on the images. So far, so good. The comments are stored in an XML file in the same folder as the image. So, for example image1.jpg might have an associated image1.xml file containng all the comments. I stored the comments in XML files instead of a database for several reasons:
- I can rename folders without breaking links to files in the database.
- When I archive folders onto CD, the comments will automatically be copied (and readable) without having to mess with a database export.
And now comes the great design shortcoming... I want to add a feature to the front page of the album that shows the last 5 comments added, with hyperlinks to the image. However, in order to do this, I will need to store the full path to the image somewhere, so that the hyperlink will work. I could create another XML file that gets updated whenever a comment is added, or I could just shove all the comments into a database and build my list from there - which would render my XML files rather pointless! :doh: Either way, I've just created a load of work for myself. If I had used a database from the beginning, then building the list of recent comments would be trivially easy, but I would lose the freedom of renaming folders and moving files. Without wishing to wander too far into "programming question" territory, what suggestions would you have for moving forward from here - XML index file or SQL Database or something else entirely?
I didn't see any actual answers to your question - so here goes. (I'm going to assume .net - but most languages would support this structure) Make a service that ties into the FileSystemChanged events - monitor the directories of yon files. When an xml file changes, update a master xml that keeps this list of 5. This allows you to keep your structure, but also respond to changes in lots of files without bothering the actual process (and quickness) of single xml files per pic. Hope this gives you an idea. Brian
-
Soooo, I have a little website that contains all my digital photos so that my family can see them without me having to constantly send images as email attachments. This works really well, as I am living in California and my family are in England and France - it really makes it easier to share the images. All I have to do is copy the contents of my digital camera into a folder on my server and the photos automatically appear on the web site. Family members have to login to see most of the images, and I've recently starting creating accounts for other people to be able to login and see photos they might be interested in. For example, my sons soccer team have an account, and they can only see soccer related images. Now, this is all working perfectly, so I decided to add a feature to allow people to leave comments on the images. So far, so good. The comments are stored in an XML file in the same folder as the image. So, for example image1.jpg might have an associated image1.xml file containng all the comments. I stored the comments in XML files instead of a database for several reasons:
- I can rename folders without breaking links to files in the database.
- When I archive folders onto CD, the comments will automatically be copied (and readable) without having to mess with a database export.
And now comes the great design shortcoming... I want to add a feature to the front page of the album that shows the last 5 comments added, with hyperlinks to the image. However, in order to do this, I will need to store the full path to the image somewhere, so that the hyperlink will work. I could create another XML file that gets updated whenever a comment is added, or I could just shove all the comments into a database and build my list from there - which would render my XML files rather pointless! :doh: Either way, I've just created a load of work for myself. If I had used a database from the beginning, then building the list of recent comments would be trivially easy, but I would lose the freedom of renaming folders and moving files. Without wishing to wander too far into "programming question" territory, what suggestions would you have for moving forward from here - XML index file or SQL Database or something else entirely?
I did my family albums with Gallery [^]. It has all the features you'll ever need or want. My problem was that my family was e-mailing me all of their photos that I had to move to the site. Gallery allows them to create and maintain their own albums. Very nice and works great. It easily integrates into an existing site and is very customizable. -- Bob
-
Hmmm..personally I would have written it to store both the comments and the photos in a database but maybe that's just me. :)
"110%" - it's the new 70%
John Cardinal wrote:
store both the comments and the photos in a database
But that's the complete opposite of what I want to do! :| The purpose is to add web browsing ability to an existing file structure. There are over 12,000 images in numerous directories, and I already have a couple of simple ASP.NET pages that can navigate the directory structure and display the images. Why would I want to make it even less portable and obfuscate all the images into a database? Because the files are in the file system, they are not only accessed via the web interface. For example, my media player in the living room uses a 3rd party screen saver to cycle through the images when it is idle.
Sunrise Wallpaper Project | The StartPage Randomizer | A Random Web Page
-
Why not just use something like Picasa Web Albums (or Yahoo! Photos) - unless you especially want to program all this stuff?
Kevin
Kevin McFarlane wrote:
Why not just use something like Picasa Web Albums (or Yahoo! Photos) - unless you especially want to program all this stuff?
I have over 12,000 images and a couple of ASP.NET pages that navigate the directory structure and display images. It is all working just fine so far, but I wanted to make it a little more interesting. So yes, I do want to program all this stuff :-D
Sunrise Wallpaper Project | The StartPage Randomizer | A Random Web Page
-
I didn't see any actual answers to your question - so here goes. (I'm going to assume .net - but most languages would support this structure) Make a service that ties into the FileSystemChanged events - monitor the directories of yon files. When an xml file changes, update a master xml that keeps this list of 5. This allows you to keep your structure, but also respond to changes in lots of files without bothering the actual process (and quickness) of single xml files per pic. Hope this gives you an idea. Brian
That's kind of what I was thinking... although I don't think I need to go as far as writing a service. Since there's only one page that allows users to add comments, I can just write to comments.XML and index.XML at the same time, whenever a new comment is added. The only problem with this of course, is multiple users updating at the same time... So then I started thinking about using MS Access to maintain the index, but something about that didn't seem to fit right - especially as I have SQL Server available. But then I've come full circle and I'm right back at using a database again! I think I'll just maintain an XML index and be done with it!
Sunrise Wallpaper Project | The StartPage Randomizer | A Random Web Page
-
John Cardinal wrote:
store both the comments and the photos in a database
But that's the complete opposite of what I want to do! :| The purpose is to add web browsing ability to an existing file structure. There are over 12,000 images in numerous directories, and I already have a couple of simple ASP.NET pages that can navigate the directory structure and display the images. Why would I want to make it even less portable and obfuscate all the images into a database? Because the files are in the file system, they are not only accessed via the web interface. For example, my media player in the living room uses a 3rd party screen saver to cycle through the images when it is idle.
Sunrise Wallpaper Project | The StartPage Randomizer | A Random Web Page
Well you code what you know I guess. To me your system sounds fragile and complex and un-portable where a database solution would be nice and clean and much easier to modify in future. There is no right or wrong answer, just different approaches.
"110%" - it's the new 70%
-
That's kind of what I was thinking... although I don't think I need to go as far as writing a service. Since there's only one page that allows users to add comments, I can just write to comments.XML and index.XML at the same time, whenever a new comment is added. The only problem with this of course, is multiple users updating at the same time... So then I started thinking about using MS Access to maintain the index, but something about that didn't seem to fit right - especially as I have SQL Server available. But then I've come full circle and I'm right back at using a database again! I think I'll just maintain an XML index and be done with it!
Sunrise Wallpaper Project | The StartPage Randomizer | A Random Web Page
If you are really concerned about concurrency issues then open the file exclusively for writing or use a mutex.
Using the GridView is like trying to explain to someone else how to move a third person's hands in order to tie your shoelaces for you. -Chris Maunder
-
Kevin McFarlane wrote:
Why not just use something like Picasa Web Albums (or Yahoo! Photos) - unless you especially want to program all this stuff?
I have over 12,000 images and a couple of ASP.NET pages that navigate the directory structure and display images. It is all working just fine so far, but I wanted to make it a little more interesting. So yes, I do want to program all this stuff :-D
Sunrise Wallpaper Project | The StartPage Randomizer | A Random Web Page
Fair enough. :)
Kevin