Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Huh? Planner, Diary, Photos

    I used 3 diffrent examples for a planner I made for my wife, (Thanks to all of you) and on the 3rd page I wanted for her to be able to save her favorite photos. Well the only problem I can find is it will let me save them but it will only allow like 3 or 4 then it wont add anymore????

    Page: On show -
    Code:
    db = SQLite.Open("Autoplay\\docs\\images.db")
    
    if db then
    
    	tblQ = SQLite.QueryToTable(db, "SELECT * FROM Images")
    
    else
    	Dialog.Message("Error", _tblErrorMessages[Application.GetLastError()])
    end
    
    if tblQ then
    
    	ListBox.DeleteItem("ListBox1", -1)
    	
    	for n=1, tblQ.Rows do
    
    		ListBox.AddItem("ListBox1", tblQ.Data[n]["Image_Title"], n)
    
    	end
    	
    end
    The list box: On select -
    Code:
    Selected = ListBox.GetSelected("ListBox1")
    
    if Selected then
    
    	x = String.ToNumber(ListBox.GetItemData("ListBox1", Selected[1]))
    	Image_Data = tblQ.Data[x]["Image"]
    	Image_ID = tblQ.Data[x]["ImageID"]
    	
    	local Image_File = _TempFolder.."\\IMG.jpg"
    	
    	Crypto.Base64DecodeFromString(Image_Data, Image_File)
    	
    	Image.Load("Image1", Image_File)
    	
    	Image.SetVisible("Image1", true)
    	
    	Button.SetEnabled("Button2", true)
    
    end
    The add photo btn: On click -
    Code:
    local Image_File = Dialog.FileBrowse(true, "Select Image File", "", "Jpeg Files (*.jpg)|*.jpg|" , "", "")
    
    if Image_File ~= "CANCEL" then
    
    	encoded_image = Crypto.Base64EncodeToString(Image_File[1], 0);
    	
    	-- Check to see if an error occurred using the Crypto.Base64EncodeToString action.
    	error = Application.GetLastError();
    	if (error ~=0) then
    	    result = Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    	    return
    	end
    	
    	if encoded_image == "" then
    		Dialog.Message("Sorry", "Could not encode image file", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
    		return
    	end
    	
    	Image_Title = Dialog.Input("Image Title", "Please enter a title for this image", "My Cool Image", MB_ICONQUESTION)
    	
    	if Image_Title == "CANCEL" or Image_Title == "" then
    		Image_Title = "My Cool Image"
    	end
    	
    	SQLite.Query(db, "Insert into Images Values(Null, \"" .. encoded_image .. "\", '" .. Image_Title .. "')")
    	
    	tblQ = SQLite.QueryToTable(db, "SELECT * FROM Images")
    	
    	if tblQ then
    
    		ListBox.DeleteItem("ListBox1", -1)
    		for n=1, tblQ.Rows do
    	
    			ListBox.AddItem("ListBox1", tblQ.Data[n]["Image_Title"], n)
    		end
    		
    	end
    
    end
    Clear btn: On click -
    Code:
    if Selected then
    
    	SQLite.Query(db, "DELETE FROM Images WHERE ImageID="..Image_ID)
    	
    	tblQ = SQLite.QueryToTable(db, "SELECT * FROM Images")
    	
    	if tblQ then
    
    		ListBox.DeleteItem("ListBox1", -1)
    		for r=1, tblQ.Rows do
    	
    			ListBox.AddItem("ListBox1", tblQ.Data[r]["Image_Title"], r)
    			Progress.SetCurrentPos("Progress1", r)
    		end
    		
    	end
    	
    	Button.SetEnabled("Button2", false)
    	
    	Image.SetVisible("Image1", false)
    
    end
    I cant figure it out, because I'm not a programing wiz, but I like to tinker around.. With that said, I don't know how to debunk it.

    Can anyone please help me??

    All I want is to be able to add as many photos as I want..!

    Thanks,
    Joe

    Ps. The .apz is like 4mb, so I can't upload it unfortunately...

  2. #2
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Peekaboo! Help!!!!

    Ok, I tried changing around code but it's still not any better, so I undone everything and now I'm ready to throw the PC out the window!!!!! Argg!

    I know, its Christmas.. BUT, I know there are allot of you talented people that can't put down a mouse, LMAO.....

    Anyone -

  3. #3
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    It looks like you are using an example I posted for storing images in an SQLite database. What happens if you use my example on its own? Are you able to insert as many photos as you like? I just tested the example and had no problems.
    Dermot

    I am so out of here

  4. #4
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Grin Hey!

    Hey Dermot, Yes I tried just the example you created and I get to 4 photo's and on the 5th it lets me pick what I want but after naming it, it dos'nt show up in the listbox!?

    Is it poss that I had a bad download? I normally don't get a bad download from the forum tho- But other than that, I love what you created. You have a great brain! Lol..

    All I did was copy/paste the code from the project and put it on a page in mine with all the other code but I can't get yours past 4 either.

    Any ideas??

  5. #5
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Here is Dermot...

    Here is Dermot example as I got it..

    go here: http://www.joesphotoshop.com

    I hope you don't mind the re-post?

    Thanks,
    Joe

  6. #6
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Works perfectly for me, must be something on your end.
    Dermot

    I am so out of here

  7. #7
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Peekaboo! Hmm

    As far as?? What I'm using for a PC, or? My Q: is how are all the other .apz's work and only his one dont? I'm not doubting you at all, Is there something I got to download to check? Or am I missing a dll? Is there another apz that you know of that is of the same lines as this one?

    Sorry for all the questions. Just trying to make it work...

    Thanks Dermot!

    Joe

  8. #8
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    I have no idea. All I know is it works for me. I don't know how many have used or tried that example, but no one has reported any problems as far as I know.

    There are no dlls or anything like that.
    Dermot

    I am so out of here

  9. #9
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Grin Well..

    I think It might be my photos are to big 3888 x 2592. I got more to work at a smaller size. I don't want a limit tho- Is there a way to resize the photo to fit when it is showed?

    Thanks Dermot,
    Joe


    Idea: I was thinking, Maybe even an export feature could be added? to download it to the desktop..
    Last edited by JDog37; 12-26-2008 at 07:49 AM. Reason: Messed up

  10. #10
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    You will run in to problems with this method if the images are very large. When the image is encoded, the SQL insert statement will be too long so the insert will fail. You will need to resize the photos before adding them to the database.
    Dermot

    I am so out of here

  11. #11
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Wink Ok

    Ok, i will do that. Any sug size?

    Thank you again Dermot, I really do appreciate your help. If you'd like I will post the project when I'm done.

    Thnks again,
    Joe

  12. #12
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Grin

    Code:
    with this method if the images are very large.
    Any other method? Is there a way to have the project scale it down on entry?

  13. #13
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    You could just save the paths to the images in the db instead of saving the actual images. The downside if this is that the app is not portable and if you move the images, the paths will be broken.

    You could use this to resize the images on the fly as you are inserting them. http://www.indigorose.com/forums/showthread.php?t=25782 Don't ask me for an example, I don't have the time. The Lua-GD docs explains the resize function.
    Dermot

    I am so out of here

  14. #14
    Join Date
    Dec 2007
    Posts
    1
    thanks for all

  15. #15
    Join Date
    Feb 2008
    Location
    Western Pennsylvania
    Posts
    555

    Smile Cool

    I'll go look at it, Thanks again Dermot!

Similar Threads

  1. Scroll box containing photos and links
    By StarCStar in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 06-05-2007, 11:25 AM
  2. Daily Planner
    By pata in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 04-25-2005, 07:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts