EzPortal - Portal Software for Forums
EzPortal Forums => ezBlocks => Topic started by: krice on April 09, 2010, 11:40:35 am
-
Hope this is the place to ask??
I would like to pull a random image from the forums "attached images" that users have uploaded and placed in their post. I believe they are all stored in the same folder.
Could this be done with a php script loaded into a php ezblock?
It would be great if the image would be random every time the page was reloaded.
Thanks, Ken
-
I don't have anything premade for fetching image attachments from posts in a forum yet.
-
Does anyone know of a code to be put in a php block or possible html block that would accomplish this without having a premade ez block?
-
Thanks Jake, I have seen some html scripts but have not had much success as I don't know it well. Will keep looking. If I find anything I will post up.
-
if people are uploading, does that mean there's a database table storing information?
if so, and you have access to the database (mine is a MySQL db, accessed via phpMyAdmin), then you can run a mysql query, put in in some php code and drop it into the ezblock...
in the query, set it to 'Order by rand()' (leave out the ticks)
i do this already on our site, and am now upgrading it to run everything through smf - inc our admin pages. i have tested dropping in full page php/mysql/html coded pages into ezblocks, and they work fine... do remember to leave out the initial <?php and the final ?> in the ezblock
-
I use the following php file to display a random image.... Just follow the instructions given in the file to set it up for your system.
SMF stores uploaded images in smf/attachments
Regards
Eddy