1
tatane
Create a site xoops whith cooloris
  • 2008/10/18 16:34

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1


Hello


I would like to create an image and video using this style effects

Is this possible?

merci

2
sailjapan
Re: Create a site xoops whith cooloris

Looks like the easiest way would be to create an RSS feed from your MySQL db using the code they give here

<? header('Content-type: text/xml'); ?>
<?php
    
require("../lib/config.php");
    require(
"../lib/functions.php");
    require(
"../lib/tag_functions.php");
    require(
"../user/database.php");
    require(
"../user/user.php");
    require(
"../lib/forms.php");
?>

<?php


  $pbpathrev  
strrev($PATH_INFO);
  
$pbslashpos strpos($pbpathrev'-');
  
$pbpathcut  substr($pbpathrev0$pbslashpos);
  
$pbdotpos   strpos($pbpathcut'.');
  
$pbrevimgid substr($pbpathcut, ($pbdotpos +1));
  
$currentset strrev($pbrevimgid);



$rssWriter = new PhotoRSSWriter;
$rssWriter->display($currentset);

class 
PhotoRSSWriter{

  function 
display($currentset){
    echo 
$this->getRss($currentset);
  }


function 
getRss($currentset){
    
$rss  $this->getRssHeader($currentset);
    
$rss .= $this->getRssItems($currentset);
    
$rss .= $this->getRssFooter();
    return 
$rss;
  }


  function 
getRssHeader($currentset){
    
$rssHeader  '<rss version="2.0"
             xmlns:media="http://search.yahoo.com/mrss/"
             xmlns:atom="http://www.w3.org/2005/Atom">
            <channel>
    <title>My Website '
.$currentset.'</title>
    <link>http://www.mywebsite.com/</link>
    <description>My Website is a great collection of my things.</description>
    <language>en-us</language>
    <lastBuildDate>' 
date("D, d M Y h:i:s") . ' EST</lastBuildDate>
    <atom:link href="http://mywebsite.com/photos.rss" rel="self" type="application/rss+xml" />
'
;

        if(
$currentset 0)
        {
          
$rssHeader .='<atom:link rel="previous" href="http://www.mywebsite.com/rss/photos-'.($currentset-1).'.rss" />
'
;
        }

        
$rssHeader .='<atom:link rel="next" href="http://www.mywebsite.com/rss/photos-'.($currentset+1).'.rss" />
'
;



    return 
$rssHeader;
  }

  function 
getRssFooter(){
    
$rssFooter .= '  </channel>
</rss>'
;
    return 
$rssFooter;
  }


  function 
getRssItems($currentset){
    
//Set up Database connection
    
mysql_connect ('localhost:3306','weblog','weblog');
    
mysql_select_db ('weblog_new');

    
$query "select c.id from content c inner join content_images ci on c.id = ci.content_id";

    
$exec mysql_query($query);
    
$browsekey  mysql_num_rows($exec);

        
$startindex =0;
        
$endindex=99;

        if(
$currentset 0)
        {
          
$startindex = ($currentset*100)+$startindex;
          
$endindex = ($currentset*100)+$endindex;
        }


    
$rssItems "";

        
// Get the Array of rss items
        
$rssItemArray getRssItems($startindex$endindex);
        
    foreach (
$rssItems as $result) {
      
$id $result['item_id'];
      
$title $this->getBareText($result["text"], 50);
      
$text $this->getBareText($result["text"]);
      
$name $result["author"];
      
$img_id $result["img_id"];
      
$timestamp $result["blog_created"];

      
$rssItems .= "    <item>
      <title>" 
.$title "</title>
      <link>http://www.mywebsite.com/browse/show-" 
.$id".html</link>
      <media:thumbnail url="
http://www.mywebsite.com/img/image/".$img_id.".jpg"/>
      
<media:content url="http://www.mywebsite.com/img/orig/" .$img_id ".jpg"/>
      <
guid isPermaLink="false">".$img_id."</guid>
    </
item>rn";

    }

    return 
$rssItems;

  }

  function getRssItems(
$startindex$endindex) {
        // goes out and gets an array of data, one row per rss item. 
  }

  function getBareText(
$text$crop = false){
    
$text = $crop? crop_string(remove_ubb($text), $crop) : $text;
    
$text = htmlspecialchars($text, ENT_QUOTES);
    
$text = trim($text);
    return 
$text;
  }
}
?>


Anyone think this is doable? Would be very cool if so...
Never let a man who does not believe something can be done, talk to a man that is doing it.

3
sailjapan
Re: Create a site xoops whith cooloris

bump
Never let a man who does not believe something can be done, talk to a man that is doing it.

4
ghia
Re: Create a XOOPS site with Cooliris
  • 2009/1/3 11:28

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I think if you use a media gallery like WebPhoto, which includes a media RSS, then you don't have to do anything.

Beware of the increased traffic, if a lot of users start to load hundreds of thumbnails at a time. Also Protector may not like it.

If you have a module with no RSS, then you can try to adapt the crude framework above. But it will be always module specific.

Things to do:
require("../lib/config.php");
    require(
"../lib/functions.php");
    require(
"../lib/tag_functions.php");
    require(
"../user/database.php");
    require(
"../user/user.php");
    require(
"../lib/forms.php");

to be replaced by XOOPS includes eg (not complete)
include "../../mainfile.php";
include_once 
XOOPS_ROOT_PATH.'/include/functions.php';
global 
$xoopsConfig;

Replace all links withhttp://www.mywebsite.com/... with the correct links to your site.
In
<lastBuildDate>' . date("D, d M Y h:i:s") . ' EST</lastBuildDate>
set the time zone.
In function getRssItems you have to adapt the database query to the XOOPS database sytem and to the tables for your module to obtain a list of IDs of photos that may be viewed by anonymous users (permissions!).
Function getRssItems should assemble an array with all the titles, texts and links to the tumbnails, photos and webpages from a given start to end index.
I think this could be more efficient combined in the first database query and the start and end index applied as a limit.
There seems also no check for the end of the gallery (last photo).

Login

Who's Online

202 user(s) are online (124 user(s) are browsing Support Forums)


Members: 0


Guests: 202


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits