Welcome Guest, Not a member yet? Register   Sign In
cooliris views
#1

[eluser]vrencianz[/eluser]
I did find the forums for a cooliris related posts and didn't find one.

If you want http://www.cooliris.com/ integrated in your web sites you can do something like the following (see a working example at: http://caselemnhr.ro/pages/gallery):

1) create a view named gallery.php (for example) containing

Code:
{article}
<div class="article" id="article_{gallery}">
    <h2>
        <span>{title}</span>
    </h2>
    <div class="clr"></div>
        <p>{description}</p>
        &lt;object id="embed_{gallery}" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="450"&gt;
            <param name="movie" value="http://apps.cooliris.com/embed/cooliris.swf" />
            <param name="allowFullScreen" value="true" />
            <param name="allowScriptAccess" value="always" />
            <param name="flashvars" value="feed=api://www.flickr.com/" />
            &lt;embed type="application/x-shockwave-flash"
                src="http://apps.cooliris.com/embed/cooliris.swf"
                  flashvars="feed=&lt;?=base_url()?&gt;mrss/{gallery}"
                  width="600"
                  height="450"
                  allowFullScreen="true"
                  allowScriptAccess="always" /&gt;
        &lt;/object&gt;
       <div class="clr"></div>
</div>
{/article}

Notice <b>
Code:
flashvars="feed=&lt;?=base_url()?&gt;mrss/{gallery}"
</b>

A gallery view will get the media rss items from that location (http://site/mrss/pictures). So, you have to handle the <i>mrss</i> fragment from the url part of the flashvars.

2) create a mrss.php file with the following content

Code:
&lt;?php if(!defined('BASEPATH'))
    exit('No direct script access allowed');

class Mrss extends CI_Controller
{
    private $ext = '.jpg';
    private $tmb = 'tmb/';

    public function __construct()
    {
        parent::__construct();

        $this->load->library('parser');
        $this->load->helper('url');
    }

    private function _setup($title, $dir, $num_images)
    {
        $data = array('title' => $title);

        for($i = 1; $i <= $num_images; $i++) {
            $data['items'][] = array('image_url' => $dir . $i, 'tmb_image_url' => $dir . $this->tmb . $i);
        }

        return $data;
    }

    public function index()
    {
    }

    public function gal1()
    {
        $this->output->cache(1440);

        $this->parser->parse('mrss', $this->_setup('Gallery 1', 'images/gallery/g1/', 15));
    }

    public function gal2()
    {
        $this->output->cache(1440);

        $this->parser->parse('mrss', $this->_setup('Gallery 2', 'images/gallery/g2/', 12));
    }
}

/* End of file Sgallery.php */

This supposes that you have 15 images (1.jpg, 2.jpg, ...) Smile located at images/gallery/g1/ and their thumbnails at images/gallery/g1/tmb/. You have to have 12 images for g2.

3) modify your .htaccess as follows

Code:
<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond $1 !^(index\.php|images|themes|robots\.txt|crossdomain\.xml)
  RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

For our example only the <b>crossdomain\.xml</b> and <b>images</b> are important.

I hope this is helpful for those who need simple image galleries.

Cheers!


Messages In This Thread
cooliris views - by El Forum - 04-22-2011, 09:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB