Selecting an Existing Image in "Events" Section Broken

Topics: Developer Discussion, Help
Jun 11, 2007 at 3:19 AM
Edited Jun 11, 2007 at 3:22 AM
Hello, I am new to this forum and would like to thank very much the hard work put in by everyone in creating this wonderful resource.

The only bug that I seem to be unable to solve thus far is when I go to create or edit an event in the "events" section. When I upload an image I have no problem in having the event description display with the correct image. However when I try to reference an existing image using the "Existing Image" button I am able to access the photo galleries but nothing updates. I am left with the default image "f.jpg" regardless of what I select.

Any suggestions would be appreciated. Thank-you very much for your time; have a great day!

EDIT: It is also broken when using the "News" section, but for the life of me I can't see the error in PhotoAlbumPicker.acsx or PhotosFormPicker.acsx.
Jun 11, 2007 at 3:39 AM
Hi, can you first tell me if you are using 2.0 final or a recent build? If you are using a recent build, which changeset?
Jun 11, 2007 at 6:05 AM
I'm using the 2.0 final build. I downloaded the most recent build but I couldn't find any differences thus far, although I am continuing to look. Thank-you for responding; any help would be appreciated.
Jun 11, 2007 at 2:57 PM
I will take a look at it and get back to you.
Jun 12, 2007 at 4:32 PM
Edited Jun 12, 2007 at 4:33 PM

I am using 2346 and having the same issues with the events page. I haven't checked the news yet but will
Jun 13, 2007 at 10:03 PM
Thank-you for taking a look at it Zach, I'll keep searching for the issue myself as well.
Jun 14, 2007 at 5:54 PM
Having the same issue in the News page.
Jun 15, 2007 at 5:00 AM
How do we move this to the issues list?
Jun 16, 2007 at 7:47 PM
I was turning the events stuff over to SubSonic and I realized that the photopicker doesn't work! I'm probably going to just allow someone to use an existing image.
Jun 18, 2007 at 8:53 PM
Zach, Not sure what you mean by your last post. Are you planning on limiting the selection of photos from different albums and just going with a stock photo?
Jun 18, 2007 at 9:55 PM
I've been doing some testing and here is what I have found.

I cleared the albums and images tables. Created two albums and placed 3 images in each album. Albums are album ID32 and 33. Images are:

18 Album ID 32
19 Album ID 32
20 Album ID 32
21 Album ID 33
22 Album ID 33
23 Album ID 33

I add a new news event and try to use existing images. I select the image and get the image with a red X in it. When you look at the properties of the images you get the following:


It appears it is pulling the AlbumID number instead of the image ID number. This appears to be code in the imagefetch.ashx but it may be something passed into it.

I am continuing to TS.
Jul 7, 2007 at 8:11 PM
The fix:

In usercontrols/photosformpicker.ascx, modify existingchosenclick to the below.

Protected Sub existingChosen_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'ImageId = CInt("0" & AlbumList2.SelectedValue)

ImageId = CInt("0" & selectedimage.Value.ToString())
End Sub

I also changed the imageid() property to be an object so the null value logic works properly, like so:
Property ImageId() As Object
If viewswitch.ActiveViewIndex = 1 Then
Return CInt(selectedimage.Value)
Dim id As Object = ViewState("ImageID")
If id Is DBNull.Value Then
Return 0
Return CInt(id)
End If

'Dim id As Object = ViewState("ImageID")
'If id Is Nothing Then
' ViewState("ImageID") = 0
' Return 0
' Return CInt(id)
'End If
End If

End Get
Set(ByVal value As Object)
ViewState("ImageID") = value
End Set
End Property

You'll have to wrap cint() around imageid references throughout the photos_formpicker.ascx where needed.
Jul 7, 2007 at 9:17 PM
Tina, does that apply to recent builds or only 2.0?
Jul 7, 2007 at 9:49 PM
Sorry, I meant to specify that. I'm using the 2.0 code. :)
Jul 8, 2007 at 1:26 AM
I can see if it is aplicable for v3 codebase. I will also try it in v2.
Jul 9, 2007 at 8:31 PM

I am a little confused about the last line of your post. "You'll have to wrap cint() around imageid references throughout the photos_formpicker.ascx where needed.".

Could you elaborate and give me an example?

Jul 9, 2007 at 8:53 PM

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)
If CInt(ImageId) <> 0 Then
imagepreview.ImageUrl = "imagefetch.ashx?ImageID=" & CInt(ImageId) & "&Size=" & imagesize()
End If
End Sub

used to be:
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)
If ImageId <> 0 Then
imagepreview.ImageUrl = "imagefetch.ashx?ImageID=" & CInt(ImageId) & "&Size=" & imagesize()
End If
End Sub
Jul 9, 2007 at 9:37 PM

Nice work! That worked great!

Jul 10, 2007 at 6:03 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 10, 2007 at 6:29 AM
Ok... this has been fixed in the latest changeset.