klik di bawah ini

Selasa, 28 Juni 2011

how to make the application upload images / photos with Gambas

After confused in recent days to find how to make applications to upload pictures, akhir'a ....
to this day I am still confused ...
...(' haha joke ')
akhir'a I get also from Google about how to make an application to upload photos / images.
and seperti'a I have to share also this article for teman2 all in need, which may have a case similar to mine that is given the task of the lecturer to make an application pack TSB.
nah, selanjut'a is the way membuat'a ..
o yes, I made the application is an application for squash (LINUX).
because the campus where I studied using LINUX.

nah components we need is a PictureBox, and ScrollView button.

If you have, we'll start with the coding on the button
double click on the button that will use to open the directory image retrieval, then the coding window class will appear.
and enter the following code :

DIM pic AS Picture

dialog.Path = "/home/miesf/pictures"
IF NOT Exist(dialog.Path) THEN
dialog.Path = user.Home
ENDIF

dialog.Filter = ["All Type (*.jpg , *.jpeg , *.png , *.bmp)", "( *.jpg )", "( *.png )"]

IF dialog.OpenFile() THEN RETURN
pic = NEW Picture
pic.Load(dialog.Path)
PictureBox.Picture = Picture[Dialog.Path]
PictureBox.Resize(pic.Width + 7, pic.Height + 7)

little explanation from me.
on the first line we create a new variable called pic with the type of picture
These variables will be very useful later on when we want to set the properties when
image is displayed, for example, set the width and height of the size of the PictureBox.

Then in the second row until the fifth, we direct the location of the user when he wants to open a picture
by default I set on the directory / home / miesf / pictures, because I save a picture
directory. You can replace it with a layout that suits your directory structure.
Furthermore, if it turns out the directory does not exist, then the user will be redirected to the home directory.

The next line is sixth, by which we select / filter-type image that we will show
While in the seventh to the last row we display the image into the PictureBox.
Images will be displayed into the PictureBox is taken from where the size of the PictureBox Dialog.Path
will adjust the width and height of images captured.
In this way, the program actually is can be tried ...
and .....
good luck ..


Related Article:

0 komentar:

Posting Komentar


 

Teman-teman