Personal Site Starter Kit - Picture Storage

Last post 05-13-2008 5:37 PM by planetzeebs. 10 replies.

Sort Posts:

  • Personal Site Starter Kit - Picture Storage

    05-12-2008, 12:10 PM
    • Loading...
    • planetzeebs
    • Joined on 05-12-2008, 12:03 PM
    • Posts 7

    Hi,

    I've just started tinkering with asp.net as well as mssql recently.  I developed my page using the Visual Studio 2005 Personal Web Site Kit and i have successfully got it up and running using godaddy as my host as you can see: http://www.bui-zeeb.com

    I'm am creating a wedding website for myself and my fiance and I want to upload several photos from an engagement ceremony (Around 500 pictures).  I tried to upload them straight to my database but when I did that, I'd get a time-out whenever I tried to access my website.  Is there an alternative I can do to get all these pictures up without linking to flickr or photobucket?  

    Thanks. 

  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 1:49 PM
    • Loading...
    • amensi
    • Joined on 02-13-2006, 7:43 PM
    • Canada
    • Posts 363

    Hi,

    Can you post the code you used to upload and retrieve those images. For a project i worked on we had to insert 2000 pictures in SQL. I had to create a custom tool to achieve this.

    Alex Mensi - Check out my blog
    Maven Technologies Inc.
    --

    Don't forget to click "Mark as Answer" on the post that helped you.
  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 2:11 PM
    • Loading...
    • planetzeebs
    • Joined on 05-12-2008, 12:03 PM
    • Posts 7
    GO
    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AddPhoto]') AND type in (N'P', N'PC'))
    BEGIN
    EXEC dbo.sp_executesql @statement = N'
    CREATE PROCEDURE [dbo].[AddPhoto]
            @AlbumID int,
            @Caption nvarchar(50),
            @BytesOriginal image,
            @BytesFull image,
            @BytesPoster image,
            @BytesThumb image
    AS
        INSERT INTO [Photos] (
            [AlbumID],
            [BytesOriginal],
            [Caption],
            [BytesFull],
            [BytesPoster],
            [BytesThumb] )
        VALUES (
            @AlbumID,
            @BytesOriginal,
            @Caption,
            @BytesFull,
            @BytesPoster,
            @BytesThumb )
    RETURN
    '
    END
  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 2:33 PM
    • Loading...
    • amensi
    • Joined on 02-13-2006, 7:43 PM
    • Canada
    • Posts 363

    Thats fine, what i want to see is your codebehind to read and write in the DB and on the ASPX

    Alex Mensi - Check out my blog
    Maven Technologies Inc.
    --

    Don't forget to click "Mark as Answer" on the post that helped you.
  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 3:08 PM
    • Loading...
    • planetzeebs
    • Joined on 05-12-2008, 12:03 PM
    • Posts 7

    Here is my admin photo page:

     

    <%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Admin"
        CodeFile="Albums.aspx.vb" Inherits="Admin_Albums_aspx" %>

    <asp:content id="Content1" contentplaceholderid="Main" runat="server">

        <div class="shim column"></div>

        <div class="page" id="admin-albums">

            <div id="sidebar">
                <h3>Add New Album</h3>
                <p>Before uploading your pictures, create an album to organize your pictures.</p>
                <asp:FormView ID="FormView1" Runat="server"
                    DataSourceID="ObjectDataSource1" DefaultMode="Insert"
                    BorderWidth="0" CellPadding="0">
                    <InsertItemTemplate>
                        <asp:RequiredFieldValidator    ID="RequiredFieldValidator1" Runat="server" ErrorMessage="You must choose a    title." ControlToValidate="TextBox1" Display="Dynamic" Enabled="false" />
                        <p>
                            Title<br />
                            <asp:TextBox ID="TextBox1" Runat="server" Width="200" Text='<%# Bind("Caption") %>' CssClass="textfield" />
                            <asp:CheckBox ID="CheckBox2" Runat="server" checked='<%# Bind("IsPublic") %>' text="Make this album public" />
                        </p>
                        <p style="text-align:right;">
                            <asp:ImageButton ID="ImageButton1" Runat="server" CommandName="Insert" skinid="add"/>
                        </p>
                    </InsertItemTemplate>
                </asp:FormView>
            </div>

            <div id="content">
                <h3>Your Albums</h3>
               
                <p>The following are the albums    currently on your site.    Click <b>Edit</b> to modify    the    pictures in    each
                album. Click <b>Delete</b> to permanently remove the album and all of its pictures</p>
               
                <asp:gridview id="GridView1" runat="server"
                    datasourceid="ObjectDataSource1" datakeynames="AlbumID" cellpadding="6"
                    autogeneratecolumns="False" BorderStyle="None" BorderWidth="0px" width="420px" showheader="false">
                    <EmptyDataTemplate>
                    You    currently have no albums.
                    </EmptyDataTemplate>
                    <EmptyDataRowStyle CssClass="emptydata"></EmptyDataRowStyle>
                    <columns>
                        <asp:TemplateField>
                            <ItemStyle Width="116" />
                            <ItemTemplate>
                                <table border="0" cellpadding="0" cellspacing="0" class="photo-frame">
                                    <tr>
                                        <td class="topx--"></td>
                                        <td class="top-x-"></td>
                                        <td class="top--x"></td>
                                    </tr>
                                    <tr>
                                        <td class="midx--"></td>
                                        <td><a href='Photos.aspx?AlbumID=<%# Eval("AlbumID") %>'>
                                            <img src="../Handler.ashx?AlbumID=<%# Eval("AlbumID") %>&Size=S" class="photo_198" style="border:4px solid white" alt="Sample Photo from Album Number <%# Eval("AlbumID") %>" /></a></td>
                                        <td class="mid--x"></td>
                                    </tr>
                                    <tr>
                                        <td class="botx--"></td>
                                        <td class="bot-x-"></td>
                                        <td class="bot--x"></td>
                                    </tr>
                                </table>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemStyle Width="280" />
                            <ItemTemplate>
                                <div style="padding:8px 0;">
                                    <b><%# Server.HtmlEncode(Eval("Caption").ToString()) %></b><br />
                                    <%# Eval("Count") %> Photo(s)<asp:Label ID="Label1" Runat="server" Text=" Public" Visible='<%# Eval("IsPublic") %>'></asp:Label>
                                </div>
                                <div style="width:100%;text-align:right;">
                                    <asp:ImageButton ID="ImageButton2" Runat="server" CommandName="Edit" SkinID="rename" />
                                    <a href='Photos.aspx?AlbumID=<%# Eval("AlbumID")%>'><asp:image ID="Image1" runat="Server"  skinid="edit" /></a>
                                    <asp:ImageButton ID="ImageButton3" Runat="server" CommandName="Delete" SkinID="delete" />
                                </div>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <div style="padding:8px 0;">
                                    <asp:TextBox ID="TextBox2" Runat="server" Width="160" Text='<%# Bind("Caption") %>' CssClass="textfield" />
                                    <asp:CheckBox ID="CheckBox1" Runat="server" checked='<%# Bind("IsPublic") %>' text="Public" />
                                </div>
                                <div style="width:100%;text-align:right;">
                                    <asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Update" SkinID="save" />
                                    <asp:ImageButton ID="ImageButton5" Runat="server" CommandName="Cancel" SkinID="cancel" />
                                </div>
                            </EditItemTemplate>
                        </asp:TemplateField>
                    </columns>
                </asp:gridview>
            </div>

        </div>
       
        <asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="PhotoManager"
            SelectMethod="GetAlbums"
            InsertMethod="AddAlbum"
            DeleteMethod="RemoveAlbum"
            UpdateMethod="EditAlbum" >
        </asp:ObjectDataSource>

    </asp:content>
     

    and the VB Page 

    Partial Class Admin_Albums_aspx
        Inherits System.Web.UI.Page

    End Class

     

    At this time i'm not looking to use the site itself to upload the pictures.  I've already placed the photos in a folder via ftp and what I want to do is incorporate each piclink into my database.
     

  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 3:12 PM
    • Loading...
    • planetzeebs
    • Joined on 05-12-2008, 12:03 PM
    • Posts 7

    Public Class Album

        Private _id As Integer
        Private _count As Integer
        Private _caption As String
        Private _ispublic As Boolean

        Public Sub New(ByVal id As Integer, ByVal count As Integer, ByVal caption As String, ByVal ispublic As Boolean)
            MyBase.New()
            _id = id
            _count = count
            _caption = caption
            _ispublic = ispublic
        End Sub

        Public ReadOnly Property AlbumID() As Integer
            Get
                Return _id
            End Get
        End Property

        Public ReadOnly Property Count() As Integer
            Get
                Return _count
            End Get
        End Property

        Public ReadOnly Property Caption() As String
            Get
                Return _caption
            End Get
        End Property

        Public ReadOnly Property IsPublic() As Boolean
            Get
                Return _ispublic
            End Get
        End Property

    End Class
     

  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 3:17 PM
    • Loading...
    • amensi
    • Joined on 02-13-2006, 7:43 PM
    • Canada
    • Posts 363

    Ok so far so good... Quick question, how big are your photos? If you wanna use just a url that points to a folder and store it in the DB that's also fine.

    Alex Mensi - Check out my blog
    Maven Technologies Inc.
    --

    Don't forget to click "Mark as Answer" on the post that helped you.
  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 3:23 PM
    • Loading...
    • planetzeebs
    • Joined on 05-12-2008, 12:03 PM
    • Posts 7
    My images range between 50k and 1mb.  I've already uploaded them into a folder and yes, I want to use a url and store that in the DB so it won't take up DB space.  It seems as though I"ll have to add another row to my Photos table.  But i'm not sure where to go from there.
  • Re: Personal Site Starter Kit - Picture Storage

    05-12-2008, 11:46 PM
    • Loading...
    • whighfield
    • Joined on 01-02-2006, 10:37 PM
    • Winterpeg, Manitoba
    • Posts 218

    If you want ideas you can check out Sue's edream and her listings of modified PWSK's.  There are a few that offer downlodable code which should give you some ideas based on how others have implemented it.

    - William

    Please mark the most helpful reply/replies as "Answer".

    Give my enhanced version of the PWSK a look.
    www.willyd.ca
  • Re: Personal Site Starter Kit - Picture Storage

    05-13-2008, 4:08 PM
    • Loading...
    • planetzeebs
    • Joined on 05-12-2008, 12:03 PM
    • Posts 7
    Thanks for your help everyone.  I seem to have everything going with the exception of one thing.  I need to change file permissions on one of my folders.  My host is GoDaddy which apparently does not have a function to change permissions within their control panel.  My ftp client doesn't help as well.  I try to change them with my client, but the permissions don't stick.  I'm on a MS base fyi. 
  • Re: Personal Site Starter Kit - Picture Storage

    05-13-2008, 5:37 PM
    • Loading...
    • planetzeebs
    • Joined on 05-12-2008, 12:03 PM
    • Posts 7
    I've actually figured the permissions issue out and am able to upload my pictures directly to my file system now.  However, I get broken links to each of the photos when i try to view them.  Is there something I'm missing?  I used this site, http://klocko.com/blog/post/2008/03/Customizing-Personal-Web-Site-Starter-Kit-to-Save-Photos-to-the-File-System.aspx to help me get my photos page up but i'm still unable to view the images i've uploaded.  They are even in my folder intact.  Any thoughts?
Page 1 of 1 (11 items)