path of an image
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
path of an image
I want save a path of a image into a get of a dialog
I can explain
I use to take the image Cgetfile but it give me
c:\bar\bitmaps\risto\cafe\cafe.jpg
on c\bar there is the Exe file
I want save only .\bitmaps\risto\cafe\cafe.jpg
or
If I have in future another folder down the cafe folder
all path respect the exe name path (GetModuleFileName(GetInstance()))
any solution pls ?
I can explain
I use to take the image Cgetfile but it give me
c:\bar\bitmaps\risto\cafe\cafe.jpg
on c\bar there is the Exe file
I want save only .\bitmaps\risto\cafe\cafe.jpg
or
If I have in future another folder down the cafe folder
all path respect the exe name path (GetModuleFileName(GetInstance()))
any solution pls ?
FWH .. BC582.. xharbour
- Rick Lipkin
- Posts: 2668
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: path of an image
Just curious .. why don't you import your images into a .rc file and call them from a compiled resource rather than from a file location?.. Reason I ask is if you store your images in a sub folder the end user may accidentally delete them and then you lose all reference to them and your images fail to load.
Check the batch file rc2dll32.bat to be able to compile all your .rc files into a .res and then include the .res into your final compile to create the .exe.
Rick Lipkin
Check the batch file rc2dll32.bat to be able to compile all your .rc files into a .res and then include the .res into your final compile to create the .exe.
Rick Lipkin
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: path of an image
Rick it is catalog user I cannot insert thenm on a rc resources
if you create a archive of friends and insert a friend and you want insert his photo , why you must insert the photo into a rc file ?
if you create a archive of friends and insert a friend and you want insert his photo , why you must insert the photo into a rc file ?
FWH .. BC582.. xharbour
Re: path of an image
You can use a Substring like :
( I noticed ".\" returns a wrong Backslash-direction. Using : "." + "\" works fine.
1. Get Your Main-directory :
c_path := CURDRIVE() + ":\" + GETCURDIR()
2. the complete Path ( can be the Result from Image-selection ) :
cFile := c_path + "\Bitmaps\Olga.jpg"
Msgalert ( c_path + "\Bitmaps\Olga.jpg" )
3. create the String :
cNewfile := "." + "\" + Substr(cFile, Len(c_path) + 2 , Len(cFile) )
Msgalert( cNewFile )
4. Test if File exists :
IF FILE ( cNewfile )
Msgalert( cNewfile + " found !", "Attention" )
ENDIF
Tested and works !!!
1. the full path
2. only the Subdirectory(s) with File
3. the Seek-result
![Image](http://www.pflegeplus.com/pictures/pathseek.jpg)
Best regards
Uwe![Laughing :lol:](./images/smilies/icon_lol.gif)
( I noticed ".\" returns a wrong Backslash-direction. Using : "." + "\" works fine.
1. Get Your Main-directory :
c_path := CURDRIVE() + ":\" + GETCURDIR()
2. the complete Path ( can be the Result from Image-selection ) :
cFile := c_path + "\Bitmaps\Olga.jpg"
Msgalert ( c_path + "\Bitmaps\Olga.jpg" )
3. create the String :
cNewfile := "." + "\" + Substr(cFile, Len(c_path) + 2 , Len(cFile) )
Msgalert( cNewFile )
4. Test if File exists :
IF FILE ( cNewfile )
Msgalert( cNewfile + " found !", "Attention" )
ENDIF
Tested and works !!!
1. the full path
2. only the Subdirectory(s) with File
3. the Seek-result
![Image](http://www.pflegeplus.com/pictures/pathseek.jpg)
Best regards
Uwe
![Laughing :lol:](./images/smilies/icon_lol.gif)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: path of an image
MdaSolution wrote:Rick it is catalog user I cannot insert thenm on a rc resources
if you create a archive of friends and insert a friend and you want insert his photo , why you must insert the photo into a rc file ?
I would prefer to store the image buffer in a memo field if I use RDD or into a binary field if I am using some RDMS.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: path of an image
hua wrote:Rao,
Do you have any examples on how to use memo fields to deal with images?
TIA.
DBFCDX RDD.
If we are having a memo filed by name IMAGE in a dbf file.
FIELD->IMAGE := MemoRead( "myimage.jpg" ) stores the image buffer in the memo field.
MemoWrit( cImageFileName, FIELD->IMAGE ) saves the image buffer to a file on disk.
fwh\samples\wwonders.dbf has a memofield IMAGE holding image buffers of different jpegs.
You can view these images with the simple program \fwh\samples\xbrimag1.prg.
This is a better way to store images of employees, products, etc.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: path of an image
Thank you very much Rao. This will solve the problem where user remembers to make regular backups of their data but not of the images.
Does it only work with DBFCDX and not DBFNTX?
Does it only work with DBFCDX and not DBFNTX?
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: path of an image
hua wrote:Thank you very much Rao. This will solve the problem where user remembers to make regular backups of their data but not of the images.
Does it only work with DBFCDX and not DBFNTX?
DBFCDX or ADSCDX, ADSADT as far as I know. I think DBFNTX memo fields can not have binary data, I am not sure.
Please note that FPT files will be very large because it contains all image data. May require periodical packing. Still this is a lot better than dealing with number of different files.
Works with all RDMS with ADO.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: path of an image
One last question on the subject Rao, what's the fastest way to display the image in the memo field? Is there any faster method compared to:
i. read memo field
ii. write binary data in memo field to a temporary file
iii. get control to read that file and refresh it.
Off the top of my head, the optimized way would seem to be to read the binary data directly into memory and get whatever control meant to display the image to use that. I'm just not sure whether that's possible to do
i. read memo field
ii. write binary data in memo field to a temporary file
iii. get control to read that file and refresh it.
Off the top of my head, the optimized way would seem to be to read the binary data directly into memory and get whatever control meant to display the image to use that. I'm just not sure whether that's possible to do
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
BCC5.82/BCC7.3
xHarbour/Harbour
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: path of an image
Off the top of my head, the optimized way would seem to be to read the binary data directly into memory and get whatever control meant to display the image to use that. I'm just not sure whether that's possible to do
You are absolutely right. It is not efficient to write to disk and then read it again.
If you run the sample xbrimag1.prg, you will notice that the image buffer is directly displayed in the browse. There are no disk writes and reads.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: path of an image
Sorry,
Perhaps I not understood How resolve it
I have the exe file C:\risto\Risto.exe
I have images for an cash application into .\bitmaps\pos
and on this folder we have many other folders
sample :
.\bitmaps\pos\imagenes
and on this we have for a sample :
.\bitmaps\pos\imagenes\bocadillos
.\bitmaps\pos\imagenes\cafes
.\bitmaps\pos\imagenes\cervezas
and on each folders we have the images sample
.\bitmaps\pos\imagenes\cervezas\heineken1.jpg
I wish save the string ".\bitmaps\pos\imagenes\cervezas\heineken1.jpg"
But I don't Know where the final user post his images
I wish save all folders ( and subfolders) respct the EXE FOlder that in this case in on C:\risto\Risto.exe
Perhaps I not understood How resolve it
I have the exe file C:\risto\Risto.exe
I have images for an cash application into .\bitmaps\pos
and on this folder we have many other folders
sample :
.\bitmaps\pos\imagenes
and on this we have for a sample :
.\bitmaps\pos\imagenes\bocadillos
.\bitmaps\pos\imagenes\cafes
.\bitmaps\pos\imagenes\cervezas
and on each folders we have the images sample
.\bitmaps\pos\imagenes\cervezas\heineken1.jpg
I wish save the string ".\bitmaps\pos\imagenes\cervezas\heineken1.jpg"
But I don't Know where the final user post his images
I wish save all folders ( and subfolders) respct the EXE FOlder that in this case in on C:\risto\Risto.exe
FWH .. BC582.. xharbour
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: path of an image
hua wrote:Any snippet of how to do it with, let say, TImage control?
TIA
Please see
viewtopic.php?f=6&t=22302&p=118743#p118743
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: path of an image
MdaSolution,
I think that you are trying to figure out where your .Exe file is running from..... You can use this:
I think that you are trying to figure out where your .Exe file is running from..... You can use this:
Code: Select all | Expand
LOCAL ExePath := cFilePath( GetModuleFileName( GetInstance() ) )
LOCAL BmpPath := ExePath + "\bitmaps\pos"
=====>
Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com
FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate
FiveWin, One line of code and it's done...
Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com
FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate
FiveWin, One line of code and it's done...