Ejemplo n.º 1
0
 $ruserid;
 $Imgs = new Images();
 while ($row = mysql_fetch_assoc($result)) {
     $url = $row['url'];
     $albumid = $row['albumid'];
     $pinnedpeople = unserialize($row['pinnedpeople']);
     $suserid = $row['userid'];
     $result1 = mysql_query("select userid from album where albumid='{$albumid}'");
     while ($row1 = mysql_fetch_assoc($result1)) {
         $ruserid = $row1['userid'];
     }
 }
 if ($_SESSION['userdetails']['secondarypicalbum'] == $albumid) {
     if ($_REQUEST['deletesrc'] == 'true') {
         $resolutions = array(32, 50, 75, 200);
         $Imgs->cropImage('../images/' . $url, '../images/' . $url, $resolutions, $_REQUEST['x'], $_REQUEST['y'], $_REQUEST['width'], $_REQUEST['height']);
     }
     if ($_REQUEST['secpicno'] == 1) {
         mysql_query("update user_info set secondarypic1='" . $_REQUEST['imageid'] . "' where userid='" . $_SESSION['userid'] . "'");
     } else {
         mysql_query("update user_info set secondarypic2='" . $_REQUEST['imageid'] . "' where userid='" . $_SESSION['userid'] . "'");
     }
     //mysql_query("insert into image (title,description,url,albumid,userid,date,pinnedpeople,vote,pt,specificlist,hiddenlist,notifyusers,accepted,reqpinusers,pinmereq,comments) values('title','description','".$filename.'.'.$ext."','".$_REQUEST['album']."','".$_SESSION['userid']."',now(),'".$a."','".$a."','".$pt."','".$specific."','".$hidden."','a:0:{}','".$accepted."','a:0:{}','a:0:{}','a:0:{}')");
     //$Imgs->setAsProPic($_REQUEST['imageid'],$_REQUEST['deletesrc'],$_REQUEST['x'],$_REQUEST['y'],$_REQUEST['width'],$_REQUEST['height']);
 } else {
     if ($_SESSION['userid'] == $suserid || $_SESSION['userid'] == $ruserid && in_array($pinnedpeople, $_SESSION['userid'])) {
         $pathinfo = pathinfo($url);
         $ext = $pathinfo['extension'];
         $filename = md5(uniqid());
         while (file_exists('../images/' . $filename . '.' . $ext)) {
             $filename .= rand(10, 25);
Ejemplo n.º 2
0
 protected function updateHeaderImage()
 {
     $type = 'header';
     $size = ['width' => 584, 'height' => 280];
     $crop = [];
     foreach (array('x', 'y', 'width', 'height', 'rotate', 'scaleX', 'scaleY') as $field) {
         $crop[$field] = $_POST[$field];
     }
     $file = $_FILES['image'];
     // crop 'n save
     if ($img = Images::cropImage($file, self::$uid, $type, $size, $crop)) {
         // wipe existing image(s)
         static::removeHeaderImage();
         // set new image
         if (static::saveHeaderImage($img)) {
             return $img;
         }
     }
     return false;
 }