Author Topic: User selected image  (Read 18203 times)

sparkythex

  • Newbie
  • *
  • Posts: 43
Re: User selected image
« Reply #15 on: January 06, 2011, 06:57:27 AM »
well maybe we were thinking backwards on this.
instead of using the open dialog for the image.
the other way around is...
can i use the path from the open dialog to set the field & then that fire to set the image?
since your research says the set cavans doesn't fire back the path.

OH an thank you for enjoying my art.

by the way -- the screen shot was of a card, i was trying to make my own dialog already.

Quote
Date: Thu, 30 Dec 2010 18:36:45 +0100
From: sparkythex@hotmail.com
Subject: Re: HyperNext bug

I got a nice suprise - you have some really great images - cartoons on your links.

About your program - unfortunately HyperNext file dialogs do not show the preview of an image - i think you could probably make your own file access with previews using a card, canvas, listbox and initially use the system dialog box to get the folder to browse - sorry its messy - i'll look into a solution for this in HyperNext V4

About setting the page for you depending upon an image.- i've just found a serious bug - when an image is dropped onto a canvas - the canvas event does not fire - this ruins so many things :(
My idea was to drop the image onto the canvas - then the canvas event would fire and allow your code to get image size, re-size canvas, and move canvas to correct postion etc - then you could generate HTML code from this :(

I hope you have a happy New Year, and fun with your programming.



On 12/24/2010 5:10 PM, sparky thex wrote:

    Thanks so much for the help you  have given.
    I really do appreciate it!!!

    Oh and merry Christmas, don't waste to much of it on this!!!

    ================
    what this screen shot shows is the add image card of my app.
    which is not quite an html editor but it is to design a template for a webcomic book that will set up the page for you in a html frame set.
    it also shows a screen shot of an html program i use.

    you can still answer this on the forum but i figured this may make it easier to help you see, what i need to accomplish, or if it can be done.

    -- original post ---

    viewtopic.php?f=17&t=72&p=275#p275

    this requires the path to be known.
    what I was after was an image open dialog  [[WITH A PREVIEW]] .
    I need the user to use a browse button that lets them chose file. or to know the path & put it in a field1 that is for url.
    then it would detect that path is valid (probably by lost focus)
    it would then load in to the canvas the preview. (it is 100x100)
    there are opts for using image default height & width. or setting custom h.& w.
    then it would generate html code that would look something like "<img style="width: 576px; height: 737px;" alt="" src="../pages/end.jpg">"
    (i wish i could show you a screen shot.)

except i must have missed something because this doesn't load the image & path  looks all weird.
instead of showing all normal like
Code: [Select]
file:///Users/thex/Desktop/my%20mac/my%20doc/my_manga/Iron%20Mistress/web/pages/end.jpgi got
Code: [Select]
Macintosh HD:Users:thex:Desktop:my mac:my doc:my_manga:Iron Mistress:web:pages:end.jpg
Code: [Select]
Local fname,fhandle,fdetails,ctypes,cpaths,cnames,fextens
Local pwidth,pheight
Global fullPathName

@ Get file handle via a Dialog Box
FileAsk(fname,fhandle,fdetails,ctypes,cpaths,cnames,fextens)

Put line 9 of fdetails into fullPathName

Put fullPathName into field 1


@@@@@@@@@
reset sizemsg
@ Clear all image banks
ImageBankReset

@ Reserve space for 1 image
ImageBankReserve(1)

@Load image and scale to full size
ImageBankLoad(1,fullPathName,1)

@ Get size of image
@@ @@ Put ImageBankWidthFN(1) into pwidth
@@ @@ Put ImageBankHeightFN(1) into pheight
@@@@@@@@@@@@@@
@ Open dialog
@FileGet
@CanvasLoadAsk(1,FileGet,1)

@@ @@ put fname into field 1

put 'Page lay out design is for 800 x800.' into mess1
put 'the width is more importaint however do to the size of the frame.' into mess1
put 'You may want to use scaling.' into mess1
put 'NOTE: Picutre size will remain,' into mess1
put 'the same, just displayed smaller.' into mess1
put 'You can use the "open in new page link" option.' into mess1
put 'to allow for viewing in full size.' into mess1

             @@@@ test for pic size.
    put field 3 into ans
if sizemsg>2 or ans>800 then
    @do nothing, assume that warning was seen.
else
    add 1 to sizemsg
    message mess1
endif
@@@@@@@@@
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: User selected image
« Reply #16 on: January 06, 2011, 01:54:19 PM »
Quote from: "sparkythex"

except i must have missed something because this doesn't load the image & path  looks all weird.
instead of showing all normal like
Code: [Select]
file:///Users/thex/Desktop/my%20mac/my%20doc/my_manga/Iron%20Mistress/web/pages/end.jpgi got
Code: [Select]
Macintosh HD:Users:thex:Desktop:my mac:my doc:my_manga:Iron Mistress:web:pages:end.jpg

I'm not sure which platform you are developing on Windows or Macintosh?

The Windows and Macintosh file path separators are "" and ":" respectively.

The first looks like the path given to web browser:-
Code: [Select]
file:///Users/thex/Desktop/my%20mac/my%20doc/my_manga/Iron%20Mistress/web/pages/end.jpg
and the second is Macintosh  full (absolute) file path:-
 
Code: [Select]
Macintosh HD:Users:thex:Desktop:my mac:my doc:my_manga:Iron Mistress:web:pages:end.jpg
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

sparkythex

  • Newbie
  • *
  • Posts: 43
Re: User selected image
« Reply #17 on: January 06, 2011, 05:05:39 PM »
Quote from: "Malkom"
I'm not sure which platform you are developing on Windows or Macintosh?

The Windows and Macintosh file path separators are "" and ":" respectively.

The first looks like the path given to web browser:-
Code: [Select]
file:///Users/thex/Desktop/my%20mac/my%20doc/my_manga/Iron%20Mistress/web/pages/end.jpg
and the second is Macintosh  full (absolute) file path:-
 
Code: [Select]
Macintosh HD:Users:thex:Desktop:my mac:my doc:my_manga:Iron Mistress:web:pages:end.jpg

well I am trying to make something cross platform.
I still use both windows & mac so want something that will look very much the same on both.
(only been using a mac for about 2 years so still new to it.)

That is correct am after a web based path, it is in what i wrote  that am working on a online, content generator/ database.  
So the results need to  be something for the web.
I didn't think about that as I every time I used an html editor it just did it that way.  (& of course the file path on windows looks that way too & as well when I opened it in firefox & IE.)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: User selected image
« Reply #18 on: January 06, 2011, 07:53:59 PM »
Quote from: "sparkythex"
Quote from: "Malkom"
I'm not sure which platform you are developing on Windows or Macintosh?

The Windows and Macintosh file path separators are "" and ":" respectively.

The first looks like the path given to web browser:-
Code: [Select]
file:///Users/thex/Desktop/my%20mac/my%20doc/my_manga/Iron%20Mistress/web/pages/end.jpg
and the second is Macintosh  full (absolute) file path:-
 
Code: [Select]
Macintosh HD:Users:thex:Desktop:my mac:my doc:my_manga:Iron Mistress:web:pages:end.jpg

well I am trying to make something cross platform.
I still use both windows & mac so want something that will look very much the same on both.
(only been using a mac for about 2 years so still new to it.)

That is correct am after a web based path, it is in what i wrote  that am working on a online, content generator/ database.  
So the results need to  be something for the web.
I didn't think about that as I every time I used an html editor it just did it that way.  (& of course the file path on windows looks that way too & as well when I opened it in firefox & IE.)

Thank you for the further explanation - I'm starting to understand now.

To convert the file path to a web format one you could use the ReplaceAll string command but as your app is cross-platform you will need to use the correct path separator depending upon whether your program is running on Macintosh or Windows:-

Code: [Select]
@ assume filePath holds your unprocessed file path
Global filePath

@ get correct path separator for the platform your program is currently on
@ HyperNext automatically returns the correct separator
Local appsep
Put FolderSeparatorFN into appsep

@ replace the app sep with a web based one
Local websep
Put '/' into websep
ReplaceAll appsep with websep in filePath

Of course you will have to convert the start of the file path to a web based one.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

 

anything