TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 542
  • Total: 542

Gallery block using imageshack as server

Started by chulian1819@gmail.com, May 03, 2008, 04:31:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chulian1819@gmail.com


Because my gallery is using too much bandwith and space, I work arround a "recent gallery images" block using imageshack as the server and its  remote RSS to show the last images added in a forum block:


//cofiguration

$rows=2;  //rows of the block
$colums=4; //colums of the block
$url="http://rss.imageshack.us/user/hcl404/rss/"; //where to find the recent images

//end configuration

function getFile($url,$timeout=0) {
# use CURL library to fetch remote file
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
if ( curl_getinfo($ch,CURLINFO_HTTP_CODE) !== 200 ) {
return('Bad Data File '.$url);
} else {
return $file_contents;
}
}


$xml=simplexml_load_string(getFile($url,10));
$channel=$xml->channel->item;       
$k=0;
echo "<table align='center'>";
for ($i=0;$i<$rows;$i++){
echo"<tr align='center'>";
for($j=0;$j<$colums;$j++){
echo "<td align='center'>";
echo $channel[$k]->description;   
$k++;
echo "</td>";
}
echo"</tr>";
}
echo "</table>";



just create an acount at http://imageshack.us/ and if you want, make it public for your forum members.

Then go to your profile at imageshack  and you will see the RSS of your images and use as the url parameter in the block, example:

$url="http://rss.imageshack.us/user/myuserlogin/rss/


hope you like it, if you have a low budget in hosting this will do the trick ;)

Zetan

Nice idea, one we use.. we use Photobucket instead. I'll have to look into RSS for Photobucket.

chulian1819@gmail.com

do you know where i can fid it?  i search the forum but didnt find anything like it

Zetan

Quote from: chulian on May 03, 2008, 07:19:33 PM
do you know where i can fid it?  i search the forum but didnt find anything like it

Find what?

Smoky

nice chulian, will have to try this  :D thanks!!

chulian1819@gmail.com

thanks smoky, hope it works, any improves please share it here  ;)

Quote from: ZTN on May 03, 2008, 07:37:27 PM
Quote from: chulian on May 03, 2008, 07:19:33 PM
do you know where i can fid it?  i search the forum but didnt find anything like it

Find what?
the code for the one you use with photobucket

thanks

Zetan

lol, I said I'd look into it.. I've never tried. But I just checked and they do have RSS feeds.

http://s150.photobucket.com/albums/s91/LABRADIO/

If you scroll to the very bottom, you'll find the feeds.

chulian1819@gmail.com

I also tried with photobuket but the rss feed is too  big so mite lag the loading of the block, anyway i think  the script might needs some minor changes (or none, rss is a standar) to use photobucket RSS, so hava nice coding it ;)  be waiting the results

alving

#8
nice code!  how do you determine the number of images to be displayed?

opppsss.. ignore that question.. stupid me!  :laugh:

This website is proudly hosted on Crocweb Cloud Website Hosting.