Author Topic: User selected image  (Read 14332 times)

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
User selected image
« on: October 21, 2010, 06:58:42 PM »
I guess hello is the best place to start, so hi to all!

I have to say i have been looking for something like this for around 12 years now.I can do a fair amount of stuff but RAD tools and languages have been a serious issue for me, a total meltdown every time i tried. Ive installed all the MS express stuff, looked at a couple of eclipse packages, looked at realbasic and i just don't get any of it.

Then i came across HN (couple of weeks ago that is), only looked at it 2 days ago though. Since then I think i slept 4 hours in 2 days, this is just too cool. All i have done is open and quickly look at the samples, and finaly settle down and play around with 'BooksHN' adding images, new buttons and textfields and linking them up to store the data.

Theres one thing i could really use some help on though if someone has the time!?

Is it possible to add a button that opens up the C drive so the user can open and place an image next to the comments textfield, maybe/ideally a placeholde image (stored in the template) that can be replaced!?????


I have loads of other questions but im too tired to formulate the words. I'll come back to them after a few hours sleep.

regards
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 423
  • Here to help you
Re: User selected image
« Reply #1 on: October 21, 2010, 09:20:44 PM »
Hi and a warm welcome to our forums and I hope you manage to get some sleep very soon.


Quote from: "tools-n-stuff"
Theres one thing i could really use some help on though if someone has the time!?

Is it possible to add a button that opens up the C drive so the user can open and place an image next to the comments textfield, maybe/ideally a placeholde image (stored in the template) that can be replaced!?????


I'm sorry but I'm not sure I understand your question - do you mean an image/icon file and some text that appear when one browses the Windows file system?  - if not please correct me and I'll try answering again.

Yes, its possible to find details of the files on the C drive and so change them but frankly i don't know where the link for the image/icon and text is stored - perhaps its stored invisibly on the root. I guess you can find some info on this by searching the web or by using HyperNext to examine the file system. However, its clearly safer to see some documentation before changing things.

Compared to most HyperNext commands the HyperNext file commands look quite daunting but basically most of the parameters are returned info about the file system being interrogated and they can be simply placed into editfields for examination or ignored if not required.

I hope this helps.

Best regards
Malkom
« Last Edit: January 01, 1970, 12: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.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: User selected image
« Reply #2 on: October 22, 2010, 05:57:42 AM »
Hi Malkom and thanks for the welcome,

And now after a few hours sleep im back to realise my message wasn't clear, in fact it was so bad that you completly mis-understood me. Sorry my bad!.

So..........

Normaly the end user can fill in the info about author, title etc etc, i would also like them to be able to import 1 photo per page entry(maybe book cover). This way when they browse, they have all the needed info and a nice photo to look at.

regards
Dayne
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 423
  • Here to help you
Re: User selected image
« Reply #3 on: October 22, 2010, 03:36:49 PM »
Hi Dayne

Yes I completely misunderstood.

The command you looking for is:-

Code: [Select]
CanvasLoadAsk(cid,fname,scale)
where:-
   cid - canvas identity - eg 1
   fname - file name retruned by the dialog box
   scale - 0 to leave unchanged, 1 to scale to fit canvas

So to place the selected image in canvas 5 and scale to fit use:-

Code: [Select]
local fname

CanvasLoadAsk(5,fname,1)


Best regards
Malkom
« Last Edit: January 01, 1970, 12: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.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: User selected image
« Reply #4 on: October 22, 2010, 09:19:01 PM »
I've got it to work, great, thanks Malkom. Well, almost anyway.

As long as i run it under HN Creator i can hit the button and it will allow me to select and load a file.
If i open a stack with the player it will crash as soon as i hit the button.
Same thing for an .exe file.

Maybe i'm doing something wrong but i can't see what yet.

Any suggestions?

cheers
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 423
  • Here to help you
Re: User selected image
« Reply #5 on: October 23, 2010, 05:39:15 AM »
Quote from: "tools-n-stuff"
I've got it to work, great, thanks Malkom. Well, almost anyway.

As long as i run it under HN Creator i can hit the button and it will allow me to select and load a file.
If i open a stack with the player it will crash as soon as i hit the button.
Same thing for an .exe file.

I've just tried under Windows 7 - and the Player and .exe version both work fine for me.

However, on Windows XP as soon as the button is hit my Comodo anti-virus scanner kicks in asking if I want to proceed. Clicking yes then both the stack and .exe work fine.
Perhaps you could check to see if your anti-virus software has Player and your .exe sandboxed so causing them to crash invisibly.
By the way, my Windows 7 also uses Comodo but without a problem when that button is hit.
« Last Edit: January 01, 1970, 12: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.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: User selected image
« Reply #6 on: October 23, 2010, 02:23:39 PM »
Hi,
 I'm on vista (can't afford another upgrade yet), and like you i use commodo.  I disabled it just in case and still get the same result. Both the stack and exe file crash when trying to open the drive.
Oh well, not to worry.
Thanks anyway
Dayne
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: User selected image
« Reply #7 on: October 23, 2010, 04:50:00 PM »
Situation Update:

Ok after further testing, i have now discovered that .stk files do not liked being opened directly by double clicking them. It makes the program crash when the button is pushed.
But if i open the player and the use it to open an stk file then it works just fine. I guess i should be happy with that, and yes i am overjoyed, but i really need the exe file to work as well.
I'll keep you informed and let you know if and how i get it working.
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 423
  • Here to help you
Re: User selected image
« Reply #8 on: October 24, 2010, 11:38:30 AM »
Quote from: "tools-n-stuff"
Situation Update:

Ok after further testing, i have now discovered that .stk files do not liked being opened directly by double clicking them. It makes the program crash when the button is pushed.
But if i open the player and the use it to open an stk file then it works just fine. I guess i should be happy with that, and yes i am overjoyed, but i really need the exe file to work as well.

Many thanks for the feedback on this - I'll check this out and see if there is a bug in HyperNext - sounds very much like one.
« Last Edit: January 01, 1970, 12: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.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: User selected image
« Reply #9 on: October 27, 2010, 12:17:26 PM »
Within the data store area ( i believe to be used for the end product) are a few files that i can't open, no extension. except  .DS_Store logic which i don't know what to open with either. On testing i now find this file in the Pictures folder.

vvpict_2_3_1

What is this exactly and how do i open it. Can it be removed if not needed.

My reason for this question is that on looking through the the guide to find out more for image saving (canvas graphics, files graphics and image banks) and testing, i am wondering if the above file has appeared in the data/pictures folder because of this or because of the placeholder image on the canvas.

I am basicly trying to get the button to save to the Data/Pictures folder without displaying the option to save elsewhere. Is my code on the right track and could this be the reason for the above file appearing in there.

If you have any thoughts on the following then feel free to help me again.  :)

I have one canvas with three independant button controls.

The 'new' button with
Code: [Select]
local fname

CanvasLoadAsk(1,fname,0)
the save button with
Code: [Select]
local fname

ImageCanvasToBank(1,2,0)
Is this right?

On the other hand the delete button i can't work out through the guide.
I want to be able to remove it from the card/page and from the internal Data storing place. Is that possible?
The reason for this is that i want to be able to run the exe file directly from a 4gig usb data device, so as to stock the info directly to the USB device. (Sorry i only know what they call it in French). Or am i barking up the wrong tree?  :|

Take 2:
Iv'e just found this,

Quote
Clears the image from the specifed image bank so freeing up memory. This also sets the image bank status to invalid.

   ImageBankClear(bid)
obviously i only want to remove the particular image for that page, but still have the option of replacing it. what happens will a new image bank be created?
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 423
  • Here to help you
Re: User selected image
« Reply #10 on: October 27, 2010, 05:55:42 PM »
Quote
Within the data store area ( i believe to be used for the end product) are a few files that i can't open, no extension. except .DS_Store logic which i don't know what to open with either. On testing i now find this file in the Pictures folder.

vvpict_2_3_1

What is this exactly and how do i open it. Can it be removed if not needed.

When a picture is loaded into a canvas or dropped onto it HyperNext makes a copy so that when it quits and then restarts it has a copy of the image to reload - the vvpict_2_3_1 is a copy made by HyperNext.




To save an image from a canvas the CanvasJPEGSave will save to a specified local folder.
Note, the final parameter sets the JPEG % quality - 100 is best,  50 is lower etc

Code: [Select]
@ save canvas 1 to the local folder
CanvasJPEGSave(1,picture.jpg,100)

@save Picture to the folder DataPictures
CanvasJPEGSave(1,'DataPicturesPicture.jpg',100)

The ImageBankSave command will also save to a local folder but saves without changing the quality of the image.

Code: [Select]
@save Image Bank 1 to the folder DataPictures
ImageBankSave(1,'DataPicturesPicture.jpg')


Yes, if your exe is on another disk the above code would still save in in the folder or sub-folders of the exe.


The image bank command ImageBankClear(bid) just clears one image in the bank. So if you have an image bank holding 10 images and you clear bank 5, then the other images will remain unchanged. The Imagebank is like an array except it holds images.
« Last Edit: January 01, 1970, 12: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 #11 on: December 23, 2010, 05:15:15 PM »
i was wondering is there a way to pull file attributes.
using
Code: [Select]
local fname,iheight
CanvasLoadAsk(1,fname,1)

would be looking for something like
     file:///Users/thex/Desktop/my%20mac/my%20doc/my_manga/Iron%20gun/web/pages/picture.jpg
or
    c:mydoc/pages/picture.jpg
Code: [Select]
@find some way to do this.
@because it doesn't work.
put fname into field 1
@ and this
put actualimageheight into field 3
put actualimagewidth into field 4
I really don't need this but it maybe nice to know later.
Code: [Select]
@maybe even this since i have the cavas scaling.
put scaleimageheight into field 5
put scaleimagewidth into field 6
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 423
  • Here to help you
Re: User selected image
« Reply #12 on: December 23, 2010, 08:33:26 PM »
Quote from: "sparkythex"
i was wondering is there a way to pull file attributes.
using
Code: [Select]
local fname,iheight
CanvasLoadAsk(1,fname,1)

would be looking for something like
     file:///Users/thex/Desktop/my%20mac/my%20doc/my_manga/Iron%20gun/web/pages/picture.jpg
or
    c:mydoc/pages/picture.jpg
Code: [Select]
@find some way to do this.
@because it doesn't work.
put fname into field 1
@ and this
put actualimageheight into field 3
put actualimagewidth into field 4
I really don't need this but it maybe nice to know later.
Code: [Select]
@maybe even this since i have the cavas scaling.
put scaleimageheight into field 5
put scaleimagewidth into field 6

Its is possible to get some file attributes using the FolderFileDetails command but it cannot return the size of the image as they are contained with the image data.

However, there is an indirect way - load the image into an image bank and read the size of the imagebank.

Code: [Select]
Local pwidth,pheight

@ Clear all image banks
ImageBankReset

@ Reserve space for 1 image
ImageBankReserve(1)

@Load image and scale to full size
ImageBankLoad(1,'picture.jpg',1)

@ Get size of image
Put ImageBankWidthFN(1) into pwidth
Put ImageBankHeightFN(1) into pheight
« Last Edit: January 01, 1970, 12: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 #13 on: December 24, 2010, 09:13:13 AM »
Quote from: "Malkom"
Its is possible to get some file attributes using the FolderFileDetails command but it cannot return the size of the image as they are contained with the image data.

However, there is an indirect way - load the image into an image bank and read the size of the imagebank.

Code: [Select]
Local pwidth,pheight

@ Clear all image banks
ImageBankReset

@ Reserve space for 1 image
ImageBankReserve(1)

@Load image and scale to full size
ImageBankLoad(1,'picture.jpg',1)

@ Get size of image
Put ImageBankWidthFN(1) into pwidth
Put ImageBankHeightFN(1) into pheight

this requires the path to be known.
what I was after was an image open dialog.
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.)
« Last Edit: January 01, 1970, 12:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 423
  • Here to help you
Re: User selected image
« Reply #14 on: December 24, 2010, 09:56:59 AM »
This code will find the full (Absolute) path to a file found by the user via a Dialog box.,
It looks messy but thats because the Dialog Box returns a lot of details about the file.

Code: [Select]
Local fname,fhandle,fdetails,ctypes,cpaths,cnames,fextens
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



The details of a file or folder is returned as a list of attributes separated by carriage returns
(in the above example - line 9 was read in order to get the full pathname)

Code: [Select]
  1    -  Name of file or folder.
   2    -  1 if it exists, 0 otherwise.
   3    -  1 if it is a folder, 0 if a file.
   4    -  1 if an alias.
   5    -  1 if visible.
   6    -  1 if locked.
   7    -  1 if writeable.
   8    -  1 if readable.
   9    -  the absolute path.
   10  -  the number of items in the folder.
   11  -  The Mac Type code.
   12  -  The Mac Creator code.
   13  -  the creation short date.
   14  -  the creation short time.
   15  -  the modification short date.
   16  -  the modification short time.
   17  -  the display name.
   18  -  1 if the extension is visible.
   19  -  the length of the data fork.
   20  -  the length of the resource fork.
   21  -  the Macintosh Directory ID - an integer.
   22  -  the Macintosh VRefNum - an integer.
   23  -  Actual name including extension.
   24  -  filename extension.
   25  -  type (user created ).
   26  -  Parent directory absolute pathname.
« Last Edit: January 01, 1970, 12: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