I have added a new column to my photos table, one that is specifically used for adding a description as well as a title for a photo. I have been successful in displaying the description in the albums (when I manually enter the data), but I cannot seem to figure
out the code to make it part of the Add Photos or when renaming a photo. It tells me that I'm passing to many arguments to the following sub class in photos.aspx.vb:
Sub Button1_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs)
Dim d As IO.DirectoryInfo = New IO.DirectoryInfo(Server.MapPath("~/Upload"))
Dim enumerator As System.Collections.IEnumerator = CType(d.GetFiles("*.jpg"), System.Collections.IEnumerable).GetEnumerator
Do While enumerator.MoveNext
Dim f As IO.FileInfo = CType(enumerator.Current, IO.FileInfo)
Dim buffer() As Byte = New Byte((f.OpenRead.Length) - 1) {}
f.OpenRead.Read(buffer, 0, CType(f.OpenRead.Length, Integer)) PhotoManager.AddPhoto([Convert].ToInt32(Request.QueryString("AlbumID")), f.Name, buffer) Loop
GridView1.DataBind()
End Sub
I can see that I am definatlely passing to many arguments b/c I'm now passing the description field and this doesn't exist in the AddPhoto method. However, I cannot see how the caption is being passed in any of the variables
([Convert].ToInt32(Request.QueryString("AlbumID")), f.Name, buffer)? I assume the caption is being added in the AddPhotos method, but I cannot see how it's being passed through. If I knew this, I might figure out how to pass my new description
field as well! I hope someone can explain how this works!
I figured out my own problem. I was adding the new variable to Public Sub New(ByVal id As Integer, ByVal count As Integer, ByVal caption As String, ByVal ispublic As Boolean) in Album.vb instead of Photo.vb. So of course, this would always crash since
I was sending to many variables Public Sub New in Photo.vb or not enough to Album.vb. Stupid oversight!
Another question (this is a bug with the personal starter kit itself): If you add a photo to an album for the first time, it is possible to enter it without a caption. However, if you want to remove that caption later, with the rename button, you get
[SqlException (0x80131904): Procedure or Function 'EditPhoto' expects parameter '@Caption', which was not supplied.]
Has anybody else come across this? And is there a fix other than deleting the photo and re-uploading?
Thanks for that. However, I did a quick search through the stored procedures and I couldn't find anything relating to @original_AlbumID with @AlbumID or @Original_PhotoID with @PhotoID. The only original I found is
@BytesOriginal.
Other people must have this glitch though. It seems to happen (to me anyways) with a fresh install of the Personal Starter Kit. Perhaps I'll start a new threat with this as the topic.
I have the same problem...can you post exactly how you fixed this. I have changed the database, stored procedure and the photomanager.cs file. I need more detailed help if possible. Thanks, Grant
junkyarddog
Member
2 Points
13 Posts
Add Description Field to Photo Album
Jan 16, 2007 02:25 PM|LINK
Hi,
I have added a new column to my photos table, one that is specifically used for adding a description as well as a title for a photo. I have been successful in displaying the description in the albums (when I manually enter the data), but I cannot seem to figure out the code to make it part of the Add Photos or when renaming a photo. It tells me that I'm passing to many arguments to the following sub class in photos.aspx.vb:
Sub Button1_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs)
Dim d As IO.DirectoryInfo = New IO.DirectoryInfo(Server.MapPath("~/Upload"))
Dim enumerator As System.Collections.IEnumerator = CType(d.GetFiles("*.jpg"), System.Collections.IEnumerable).GetEnumerator
Do While enumerator.MoveNext
Dim f As IO.FileInfo = CType(enumerator.Current, IO.FileInfo)
Dim buffer() As Byte = New Byte((f.OpenRead.Length) - 1) {}
f.OpenRead.Read(buffer, 0, CType(f.OpenRead.Length, Integer))
PhotoManager.AddPhoto([Convert].ToInt32(Request.QueryString("AlbumID")), f.Name, buffer)
Loop
GridView1.DataBind()
End Sub
I can see that I am definatlely passing to many arguments b/c I'm now passing the description field and this doesn't exist in the AddPhoto method. However, I cannot see how the caption is being passed in any of the variables ([Convert].ToInt32(Request.QueryString("AlbumID")), f.Name, buffer)? I assume the caption is being added in the AddPhotos method, but I cannot see how it's being passed through. If I knew this, I might figure out how to pass my new description field as well! I hope someone can explain how this works!
Thanks!
John
junkyarddog
Member
2 Points
13 Posts
Re: Add Description Field to Photo Album
Jan 17, 2007 12:52 AM|LINK
Hi again,
I figured out my own problem. I was adding the new variable to Public Sub New(ByVal id As Integer, ByVal count As Integer, ByVal caption As String, ByVal ispublic As Boolean) in Album.vb instead of Photo.vb. So of course, this would always crash since I was sending to many variables Public Sub New in Photo.vb or not enough to Album.vb. Stupid oversight!
Another question (this is a bug with the personal starter kit itself): If you add a photo to an album for the first time, it is possible to enter it without a caption. However, if you want to remove that caption later, with the rename button, you get
[SqlException (0x80131904): Procedure or Function 'EditPhoto' expects parameter '@Caption', which was not supplied.]
Has anybody else come across this? And is there a fix other than deleting the photo and re-uploading?
Thanks!
John
remember_ale...
Member
57 Points
13 Posts
Re: Add Description Field to Photo Album
Jan 17, 2007 04:33 AM|LINK
I had a similar issue. Check the stored procedures for the word original. Try this
replace:
@original_AlbumID with @AlbumID
@Original_PhotoID with @PhotoID
I can't remember all of the places this occurs, but if you replace each one, you should be able to change the captions and such.
junkyarddog
Member
2 Points
13 Posts
Re: Add Description Field to Photo Album
Jan 17, 2007 04:19 PM|LINK
Hi,
Thanks for that. However, I did a quick search through the stored procedures and I couldn't find anything relating to @original_AlbumID with @AlbumID or @Original_PhotoID with @PhotoID. The only original I found is @BytesOriginal.
Other people must have this glitch though. It seems to happen (to me anyways) with a fresh install of the Personal Starter Kit. Perhaps I'll start a new threat with this as the topic.
John
remember_ale...
Member
57 Points
13 Posts
Re: Add Description Field to Photo Album
Jan 17, 2007 04:30 PM|LINK
junkyarddog
Member
2 Points
13 Posts
Re: Add Description Field to Photo Album
Jan 17, 2007 06:25 PM|LINK
Same thing in PhotoManager.vb, only @BytesOriginal...
ruinedmind
Member
247 Points
54 Posts
Re: Add Description Field to Photo Album
Dec 28, 2008 11:07 PM|LINK