BBcode that generates an image gallery

Get help developing custom BBCodes or request one.
Post Reply
Elya
Registered User
Posts: 1
Joined: Thu Sep 06, 2018 8:31 am

BBcode that generates an image gallery

Post by Elya » Fri Sep 07, 2018 8:50 am

Hi guys,

I'm trying to put together a code that would allow me to :

- automatically list the image files from a given directory on my server
- get the list back as a string
- use that string to generate a gallery image

The BBcode itself would look like this:

[gallery]folder_name[/gallery]

So I managed to write the code in PHP that returns the list of image files from a directory. The code is in a php file that I have uploaded to my ./forum directory. When displaying that PHP page in my browser, I can see the list of the image items, each separated with a comma.

I wrote a JavaScript function that takes two arguments : the name of the folder (which contains the images) and the list of image names separated with a comma.

But I couldn't go any further as I haven't found a way to use the result of the PHP file (the list of images) with my JavaScript function (the one that generates the image gallery). Since the page has to be reloaded when the form is submitted when someone posts a message on the board, I thought there would be no problem using PHP with JS and there would be no need for Ajax. But I'm not really familiar with these things so help would be greatly appreciated, thanks!

User avatar
Mick
Support Team Member
Support Team Member
Posts: 20231
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: BBcode that generates an image gallery

Post by Mick » Fri Sep 07, 2018 10:40 am

The fact that you're using an external file goes against the mo for custom BBCodes. The idea is that an admin can install a bbcode on his board without requiring programming or extra files. In any case, I think you'd be better off making an extension for this, you seem well up on the coding side of things, or you can make an extension request as this seems over the top for a custom bbcode.
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 11 guests