Advertisement
kitt

displayAll photo.php

Dec 22nd, 2011
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1.   public function displayAll ( $delete = false) {  
  2.         if (isset($_POST['ph_id'])) {
  3.             $p = new photo();
  4.             $content .= $p->deleteSelection($_POST['ph_id']);
  5.         }
  6.         if ($delete ) $content = '<form action="'.$_SERVER['REQUEST_URI'].'"  enctype="multipart/form-data" method="post">';
  7.         $content .= '<div id="gallery" ><ul>';
  8.         $q = db::getInstance()->q( 'SELECT * FROM sm_photos WHERE `fk_web_id` = "'. website::get_session()->id .'"');
  9.         while ( $array = $q->fetch_array() ) {
  10.             $i = new image( 'uploads/'. website::get_session()->key .'/photos/'.$array['name']);
  11.             if ( $i->is_bigger_than( 100, 100) ) {
  12.                 $i->resize( 100, 100 , 'uploads/'. website::get_session()->key .'/photos/'. 'temp100_'. $array['name'] );
  13.                 $i2 = new image( $i->image );
  14.                 if ( $i2->is_bigger_than( 600, 600) ) {
  15.                     $i2->resize( 600, 600 , 'uploads/'. website::get_session()->key .'/photos/'. 'temp600_'. $array['name'] );
  16.                     $i->image = $i2->target;
  17.                 }
  18.                 $content .= '<li><a href="'. $i->image .'" target="_blank" title="'.$array['legend'].'"  >
  19.                                <img src="'. $i->target .'" class="png" /></a>';
  20.             }
  21.             else {
  22.                 $content .= '<li><img src="'. $i->image .'" title="'.$array['legend'].'" />';
  23.             }
  24.             if ($delete ) $content .= '<br /><input type="checkbox" name="ph_id[]" value="'.$array['id'].'" />';
  25.            
  26.             $content .= '</li>';
  27.         }
  28.         $content .= '</ul></div>';
  29.         if ($delete ) $content .= '<input type="submit" name="submit" value="Supprimer les photos sélectionnées" /></form>';  
  30.         return $content;   
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement