| 1 | <table style="width:100%;border-collapse:collapse;border:1px solid dotted"> |
|---|
| 2 | <tr> |
|---|
| 3 | <td style="text-align:left;" colspan="5"> |
|---|
| 4 | |
|---|
| 5 | <?php echo $form->create('Images','post', array("enctype"=>"multipart/form-data") ); ?> |
|---|
| 6 | <?php echo $form->hidden('Image.return', '/admin/images/listview'); ?> |
|---|
| 7 | <fieldset> |
|---|
| 8 | <legend>Upload Image</legend> |
|---|
| 9 | |
|---|
| 10 | <?php echo $form->labelTag( 'Image/file', 'Title:' ); |
|---|
| 11 | echo $html->file('Image/file'); |
|---|
| 12 | echo $html->tagErrorMsg('Image/file', 'Title is required.'); |
|---|
| 13 | echo $html->submit('Upload'); ?> |
|---|
| 14 | </fieldset> |
|---|
| 15 | </form> |
|---|
| 16 | </td> |
|---|
| 17 | </tr> |
|---|
| 18 | |
|---|
| 19 | <?php |
|---|
| 20 | |
|---|
| 21 | $counter = 0; // five images in one row |
|---|
| 22 | |
|---|
| 23 | foreach ($data as $val) |
|---|
| 24 | { |
|---|
| 25 | $counter++; |
|---|
| 26 | |
|---|
| 27 | $image_stats = getimagesize('img/imgusers/'.$val['Image']['file']); |
|---|
| 28 | |
|---|
| 29 | if ( $counter == 1 ) // open new row |
|---|
| 30 | { |
|---|
| 31 | echo "<tr>"; |
|---|
| 32 | } |
|---|
| 33 | ?> |
|---|
| 34 | <td style="text-align:center;padding:3px;vertical-align:top;"><span style="font-size:8px;"><?php echo '/img/imgusers/'.$val['Image']['file']; ?></span><br /><br /> |
|---|
| 35 | |
|---|
| 36 | <?php |
|---|
| 37 | |
|---|
| 38 | $tooltip = 'W:'.$image_stats[0].' H:'.$image_stats[1] . ' counter' . $counter; |
|---|
| 39 | |
|---|
| 40 | echo $html->link($html->image('imgusers/thumbs/'.$val['Image']['file'], array("alt"=>$tooltip, "title"=>$tooltip)), '/img/imgusers/'.$val['Image']['file'], null, null, false); ?> |
|---|
| 41 | |
|---|
| 42 | <br /> |
|---|
| 43 | <?php |
|---|
| 44 | if ( $session->read('Auth.User.id') == $val['Image']['user_id'] ): |
|---|
| 45 | echo $form->create('Image', array('action'=>'delete')); |
|---|
| 46 | echo $form->hidden('Image.return', array('value'=>'/admin/images/listing')); |
|---|
| 47 | echo $form->hidden('Image.id', array('value'=>$val['Image']['id'])); |
|---|
| 48 | echo $form->end('Delete'); |
|---|
| 49 | endif; |
|---|
| 50 | |
|---|
| 51 | echo '</td>'; |
|---|
| 52 | |
|---|
| 53 | if ( $counter == 5 ) |
|---|
| 54 | { |
|---|
| 55 | print "</tr>"; |
|---|
| 56 | $counter = 0; //reset counter |
|---|
| 57 | } |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | if ( $counter < 5 ) |
|---|
| 61 | { |
|---|
| 62 | $colspan = (5 - $counter); |
|---|
| 63 | print '<td colspan="'.$colspan.'"> </td></tr>'; // fill the row with column |
|---|
| 64 | |
|---|
| 65 | } |
|---|
| 66 | ?> |
|---|
| 67 | </table> |
|---|