Gallery problem: one query, different images size - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Gallery problem: one query, different images size (/showthread.php?tid=3266) |
Gallery problem: one query, different images size - El Forum - 09-20-2007 [eluser]Référencement Google[/eluser] Hi, I am stopped with a problem. I have 1 DB query that return 5 rows, that rows are the photo files. My gallery has 1 big picture and then 4 thumbnails. I don't know how to make that working, need some help. Some code will help: In the model, the query: Code: SELECT * FROM nip_photo LIMIT 5 Then, in the controller: Code: // The function _get_latestProfiles() retrieve the photos data from the DB Then the view: Code: <!-- HERE is my problem, Note that I simplified my original code. I don't have problem printing thumnails on screen, this is working, I just don't know how to make things to get the first DB row as the big picture and the following result rows as thumbnails. Some help ? Gallery problem: one query, different images size - El Forum - 09-20-2007 [eluser]Michael Wales[/eluser] Code: $query = $this->db->get('nip_photo', 5, 0); Gallery problem: one query, different images size - El Forum - 09-20-2007 [eluser]Référencement Google[/eluser] That's a very good start for me Walesmd, thank you. Now, I've got difficulties with arrays, I am again stopped with thumbnails loop, so actually my code looks like that: Code: <?php How should I do ? Gallery problem: one query, different images size - El Forum - 09-20-2007 [eluser]Michael Wales[/eluser] Code: <?php foreach($data['pics'] as $id => $image): ?> That should work for you. If not, do a print_r of your array $data['pics'] and paste here for me. Gallery problem: one query, different images size - El Forum - 09-20-2007 [eluser]Référencement Google[/eluser] That works partially. I've got now the first thumbnail the same as the large picture, this is what I wanted to avoid, I need that the large picture is different that all the thumbnails. I post the full actual code: Code: <?php And the print_r of $data['pics'] Code: Array Gallery problem: one query, different images size - El Forum - 09-20-2007 [eluser]Référencement Google[/eluser] Just found it! This code does the trick: Code: <?php for($i = 2; $i <= count($data['pics']); $i++): ?> Thanks Michael, you put me on the way. |