Web Gallery

Get help using Construct 2

Post » Sat Feb 09, 2013 12:28 am

It is possible to make a gallery with construct2 like this one???

http://www.jstyler.net/

for example, if in my ftp i have a folder imgs where i drag and drop jpg files and its updated in the construct2 app when its hosted on my ftp?

Its is possible to make that kind of gallery?

thanksimothep852013-02-09 09:53:42
B
32
S
9
G
6
Posts: 1,467
Reputation: 7,951

Post » Sat Feb 09, 2013 10:00 am

no one?
B
32
S
9
G
6
Posts: 1,467
Reputation: 7,951

Post » Sat Feb 09, 2013 2:18 pm

Yes, pretty much, minus the ability to read a directory without some server side script.

That would be reinventing the wheel tho... Might do a search for free gallery scripts. I'm sure there's literally hundreds.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Feb 09, 2013 2:25 pm

yeah i know :s its like reinventing the wheel, but im really curious about construct2 if this kind of stuff can be developed with this engine, its allways good to think far than just games.
and i have buy my licence to learn first this engine, and after for creating web apps or games.
B
32
S
9
G
6
Posts: 1,467
Reputation: 7,951

Post » Sat Feb 09, 2013 9:26 pm

imageViewer.capx
A basic example with Canvas plugin

you need to put a file named list.txt in the folder IMAGE_FOLDER (by default 'gallery') relative to your index.html
In this file, you should have the list of images like that:
Code: Select all
myImage1.jpg
myImage2.jpg
myImage3.jpg
...

they should be in the same folder as list.txt

Then it should work like that:
http://dl.dropbox.com/u/23551572/C2-Gam ... index.html
with list.txt

Using canvas was the only way to avoid reloading the image each time since you can't have different texture per instances of a sprite.
The alternative idea was to set enough blank frames in the image sprite and load your image in each of them.
But using canvas you can have any number of images, you'll just have to upload images and update list.txt without having to worry about re-exporting a capx.



And if you need a php script for automatic listing, that should be enough:
Code: Select all
<?php
$imageDirectory = '.';
$allowedExtensions = 'png,jpg,gif,bmp';

$dir = opendir($imageDirectory);
$ext = explode(',',$allowedExtensions);

if ($dir) {
    while (false !== ($entry = readdir($dir))) {
         $info = pathinfo($entry);
         if (in_array($info['extension'],$ext)) {
            echo "$entry\n";
        }
    }
    closedir($dir);
}
?>
Yann2013-02-09 21:51:05
Last edited by Yann on Sun Sep 14, 2014 7:30 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Feb 09, 2013 11:24 pm

yeaaaaaaaaaaah :D fantastic loool :D thanks yann :D that prove its very possible, now a question the gallery you made is very good, but you think its possible betwen each picture its possible to add a fade effect??
picture 1 when clic fade to picture 2 etc :D
B
32
S
9
G
6
Posts: 1,467
Reputation: 7,951

Post » Sun Feb 10, 2013 12:41 am

easy peasy... updated
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Feb 10, 2013 12:44 am

niiice lool :D i supose if we want the fade effect more "fluid" it just need to be accelerated?
B
32
S
9
G
6
Posts: 1,467
Reputation: 7,951

Post » Sun Feb 10, 2013 12:51 am

this, <?php
$imageDirectory = '.';
$allowedExtensions = 'png,jpg,gif,bmp';

$dir = opendir($imageDirectory);
$ext = explode(',',$allowedExtensions);

if ($dir) {
    while (false !== ($entry = readdir($dir))) {
        $info = pathinfo($entry);
        if (in_array($info['extension'],$ext)) {
            echo "$entry\n";
        }
    }
    closedir($dir);
}
?>

have to be added into the capx?
B
32
S
9
G
6
Posts: 1,467
Reputation: 7,951

Post » Sun Feb 10, 2013 1:07 am

That's php.
If you have a server that runs php you can create a file name for instance
list.php
you copy/paste this code in it
you put this file where the images are
and you modify event 2 to call list.php instead of list.txt

The php script will just look into the folder it is in, list all the files with extension, png, jpg, gif, or bmp like they are in list.txt (one file by line)
It's just more automatic. It facilitate update since you'll just have to add images in the folder.
However you'll have no control over ordering. (I don't know if the script orders alphabetically, or by date of modification...)Yann2013-02-10 01:09:24
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests