Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
darzon
14
Years of Service
User Offline
Joined: 23rd Oct 2010
Location: Italy
Posted: 30th Aug 2017 22:11
Hi,
I have a problem on windows
I have on disc C: a folder named pics in which there are six jpg images
named 01.jpg, 02.jpg , 03.jpg , 04.jpg ,05.jpg, 06.jpg
and this is my code

SetErrorMode(2)
SetWindowSize( 1280, 800, 1 )
Setvirtualresolution(1280,800)
SetScissor(0,0,0,0)

global dim img1$[10]
img1$[0] = " "
img1$[1] = " "
img1$[2] = " "
img1$[3] = " "
img1$[4] = " "
img1$[5] = " "
img1$[6] = " "
img1$[7] = " "
img1$[8] = " "
img1$[9] = " "
img1$[10] = " "

f=OpenRawFolder("C:\pics\")
x1 = GetRawFolderNumFiles(f)


for w=0 to x1 - 1
t= w+1
img1$[t]= "C:\pics\" + GetRawFolderFileName( f, w )
next

CloseRawFolder(f)

do
print(str(x1))
print(img1$[1])
print (img1$[2])
print (img1$[3])
print (img1$[4])
print (img1$[5])
print (img1$[6])
sync()
loop

so the result of the print is correct and print on screen

6
C:\pics\01.jpg
C:\pics\02.jpg
C:\pics\03.jpg
C:\pics\04.jpg
C:\pics\05.jpg
C:\pics\06.jpg

but if i want visualize 01.jpg (that is on variable img$[1] ) and
insert this line of code (after the instruction CloseRawFolder(f) )

bk0= CreateSprite(LoadImage (img1$[1]) )

and comment all the print in do loop

AGK make an error message :
Error: Could not find image: C:\pics\01.jpg in main.agc at line 61

where is the error ?
thak you
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Aug 2017 22:24 Edited at: 30th Aug 2017 22:27
As far as I know the function
Quote: "LoadImage"
looks into the media folder of your project
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 30th Aug 2017 23:01 Edited at: 30th Aug 2017 23:02
you need to use the "raw:" prefix when accessing files outside the read/write folders

Login to post a reply

Server time is: 2024-11-25 00:13:54
Your offset time is: 2024-11-25 00:13:54