I have my Gallery 3 installation at http://albums.yinfor.com/
I want to put a image block into the home page of https://www.yinfor.com/
After doing my search and search, I find the module randimg. I download the source file and make some changes to suitable my own needs.
1) Download the source file here.
2) Decompress the package.
3) Open the file: randimg -> helpers -> randimg.php


find the following:

$table_prefix = $db->table_prefix;

replaced by:

$table_prefix = "g3";

g3 is my database table prefix.
4) Open file: randimg -> views -> randimg.html.php
find the following:

img src="http://$virtpath/var/resizes/$imgpath"

replaced by:

img src="http://$virtpath/var/thumbs/$imgpath"

I would like to use thumbs instead of resizes in my image block.
5) Upload randimg folder into my Gallery 3 installation under modules.
6) Signin Gallery 3 with administrator user and enabled this module.
7) put the following code into the home page of my site.

$imglink = file_get_contents("http://albums.yinfor.com/index.php/randimg", "r");
echo "$imglink";

David Yin

David is a blogger, geek, and web developer — founder of FreeInOutBoard.com. If you like his post, you can say thank you here

Leave a Reply

Your email address will not be published. Required fields are marked *