Welcome Guest, Not a member yet? Register   Sign In
Photo Gallery
#1

[eluser]RogerM[/eluser]
Hi Everyone,

I am new to CodeIgniter and love it already...

I have my current php programs written by hand or by using an open source script.

I would like to create a proofing gallery for my clients website. Any suggestions on how to render a gallery?

I think I am going to store the information in a database, the title, file path etc...

But how would I format a gallery in the view?


Thanks in advance....

Roger
#2

[eluser]mscahill[/eluser]
I'm interested in this, too. Maybe this will bump the post...
#3

[eluser]alectrash[/eluser]
I did this a while ago, not sure if it helps?
In controller I have

Code:
function page()
{
    $data['menuitem'] = $this->uri->segment(1);
    $data['itemnumber'] = $this->uri->segment(3);
    
    //get query for all digital art
    $data['query'] = $this->db->where('dbstatus', 'published')->get('tblmedia');
    $item_count = count($data['query']->result());
    $config['base_url'] = '/gallery/page';
    $config['total_rows'] = $item_count;
    $config['per_page'] = '12';
    $data['per_page'] = $config['per_page'];
    
    
    $this->pagination->initialize($config);
    if($item_count > $config['per_page'])
    {
     $this->pagination->create_links();  
    }
    
    $this->load->view('gallery_view', $data);
    
}

And in view I have

Code:
<div id="gallery">
<h2>Gallery</h2>
&lt;?=$this->pagination->create_links();?&gt;
&lt;?php

  $counteditems = 0;
  
  if(isset($itemnumber))
  {
    $itemnumber = $itemnumber;
  }
  else
  {
    $itemnumber = 0;
  }
  
  $endnumber = $itemnumber + 12;
  
  echo "<div class='itemrow'>";
  foreach($query->result() as $row)
    {
    if($counteditems >= $itemnumber && $counteditems < $endnumber)
    {
        echo '<div class="item">';
        echo '<p>
        <a >dburl . '" title="' . $row->dburl . '"><img >dbthumbimage . '" alt="' . $row->dburl . '" /></a>
        <a >dburl . '" title="' . $row->dburl . '">' . $row->dbtitle . '</a></p>';
        echo '</div>';
        
        $rownumber = ($counteditems+1) / 4;
        
        if(is_int($rownumber) && $rownumber !== 0)
        {
          echo "</div><div class='itemrow'>";
        }
    }
     $counteditems++;
  }
  echo "</div>"

?&gt;
</div>

It makes an nice 4 by 3 grid of thumbnails that link to another page where u can view image and a comment etc
#4

[eluser]mscahill[/eluser]
How do you display the albums?
#5

[eluser]alectrash[/eluser]
Sorry yeah your rite that code is just for a list of images.

Change the code so instead of a thumbnail for each image, that thumbnail is for the album, then onclicking on that thumbnail it goes through to another page with same code but this time outputs thumbnails of images within that album.
#6

[eluser]mscahill[/eluser]
How are you doing the thumbnails? I'd imagine that would be the hardest part of the process. I want to have this set up similar to zengallery where you just dump the images in a folder via FTP, and the application does the rest...
#7

[eluser]Jelmer[/eluser]
Take a look at the simple gallery class I wrote a while ago: http://ellislab.com/forums/viewthread/86266/




Theme © iAndrew 2016 - Forum software by © MyBB