예제 #1
0
파일: avatar.php 프로젝트: ecr007/pr0n
            $image->process($avatar_tmp, $dst, 'MAX_HEIGHT', 240, 200);
            $image->resize(true);
            if (file_exists($dst) && filesize($dst) > 100) {
                $_SESSION['message'] = $lang['user.avatar_upload_msg'];
                $_SESSION['uploaded'] = true;
                VRedirect::go($config['BASE_URL'] . '/user/avatar');
            }
        }
    }
}
if (isset($_POST['avatar_crop_submit'])) {
    $filter = new VFilter();
    $x = $filter->get('x1', 'INTEGER');
    $y = $filter->get('y1', 'INTEGER');
    $width = $filter->get('width', 'INTEGER');
    $height = $filter->get('height', 'INTEGER');
    $uid = $user['UID'];
    $src = $config['BASE_DIR'] . '/media/users/orig/' . $uid . '.jpg';
    $dst = $config['BASE_DIR'] . '/media/users/' . $uid . '.jpg';
    $image = new VImageConv();
    $image->process($src, $dst, 'EXACT', 100, 120);
    $image->crop($x, $y, $width, $height, true);
    if (file_exists($dst) && filesize($dst) > 100) {
        $sql = "UPDATE signup SET photo = '" . intval($user['UID']) . ".jpg' WHERE UID = " . intval($uid) . " LIMIT 1";
        $conn->execute($sql);
        $_SESSION['message'] = $lang['user.avatar_crop_msg'];
        VRedirect::go($config['BASE_URL'] . '/user/avatar');
    }
}
$smarty->assign('crop', $crop);
$smarty->assign('uploaded', $uploaded);
예제 #2
0
                $conn->execute($sql);
                $photo_id = mysql_insert_id();
                $src = $values['tmp_name'];
                $dst = $config['BASE_DIR'] . '/media/photos/tmb/' . $photo_id . '.jpg';
                list($width, $height) = getimagesize($src);
                $crop_w = min($width, $height);
                $crop_h = $crop_w;
                if ($width > $height) {
                    $crop_x = floor(($width - $crop_w) / 2);
                    $crop_y = 0;
                } else {
                    $crop_x = 0;
                    $crop_y = floor(($height - $crop_h) / 2);
                }
                $image->process($src, $dst, 'EXACT', $crop_w, $crop_h);
                $image->crop($crop_x, $crop_y, $crop_w, $crop_h, true);
                $image->process($dst, $dst, 'MAX_WIDTH', 400, 0);
                $image->resize(true, true);
                $dst = $config['BASE_DIR'] . '/media/photos/' . $photo_id . '.jpg';
                $image->process($src, $dst, 'MAX_WIDTH', 960, 0);
                $image->resize(true, true);
                ++$photos;
            }
        }
    }
    $sql = "UPDATE albums SET total_photos = total_photos+" . intval($photos) . " WHERE AID = " . $aid . " LIMIT 1";
    $conn->execute($sql);
    $_SESSION['message'] = $lang['album.add_photos_msg'] . '!';
    header('Location: ' . $config['BASE_URL'] . '/album/' . $aid);
    die;
}
예제 #3
0
파일: add.php 프로젝트: ecr007/pr0n
                    if ($caption != '') {
                        $sql_add = ", caption = '" . mysql_real_escape_string($caption) . "'";
                    }
                    $sql = "INSERT INTO photos SET AID = " . $album_id . $sql_add;
                    $conn->execute($sql);
                    $photo_id = mysql_insert_id();
                    $src = $values['tmp_name'];
                    $dst = $config['BASE_DIR'] . '/media/photos/tmb/' . $photo_id . '.jpg';
                    $image->process($src, $dst, 'MAX_WIDTH', 150, 0);
                    $image->resize(true, true);
                    $dst = $config['BASE_DIR'] . '/media/photos/' . $photo_id . '.jpg';
                    $image->process($src, $dst, 'MAX_WIDTH', 575, 0);
                    $image->resize(true, true);
                }
            }
        }
        $src = $config['BASE_DIR'] . '/media/photos/tmb/' . $photo_id . '.jpg';
        $dst = $config['BASE_DIR'] . '/media/albums/' . $album_id . '.jpg';
        $image->process($src, $dst, 'EXACT', 120, 140);
        $image->crop(0, 0, 120, 140, true);
        $sql = "UPDATE albums SET total_photos = " . intval($photos) . ", status = '1' WHERE AID = " . $album_id . " LIMIT 1";
        $conn->execute($sql);
        $sql = "UPDATE channel SET total_albums = total_albums+1 WHERE CHID = " . $category . " LIMIT 1";
        $conn->execute($sql);
        $sql = "UPDATE signup SET total_albums = total_albums+1 WHERE UID = " . $uid . " LIMIT 1";
        $conn->execute($sql);
        $messages[] = 'Album was successfully added!';
    }
}
$smarty->assign('album', $album);
$smarty->assign('categories', get_categories());
예제 #4
0
파일: embed.php 프로젝트: ecr007/pr0n
        $tmp_dir = $config['BASE_DIR'] . '/tmp/thumbs/' . $vid;
        @mkdir($tmb_dir);
        @mkdir($tmp_dir);
        $width = (int) $config['img_max_width'];
        $height = (int) $config['img_max_height'];
        $i = 1;
        foreach ($_FILES as $file) {
            $tmb = $i . '.jpg';
            if (move_uploaded_file($file['tmp_name'], $tmp_dir . '/' . $tmb)) {
                $src = $tmp_dir . '/' . $tmb;
                $dst = $tmb_dir . '/' . $tmb;
                $dst_tmp = $tmp_dir . '/' . $tmb . '.tmp.jpg';
                $image->process($src, $dst_tmp, 'MAX_WIDTH', $width, 0);
                $image->resize(true, true);
                $image->process($dst_tmp, $dst, 'EXACT', $width, $height);
                $image->crop(0, 0, $width, $height, true);
                ++$i;
            }
        }
        $vkey = substr(md5($vid), 11, 20);
        $conn->execute("UPDATE video SET vkey = '" . $vkey . "', thumbs = " . ($i - 1) . ", active = '1'\n\t\t                WHERE VID = " . $vid . " LIMIT 1");
        $messages[] = 'Successfuly embeded video!';
    }
}
function duration_to_seconds($duration)
{
    $dur_arr = explode(':', $duration);
    if (!isset($dur_arr['1'])) {
        return FALSE;
    }
    $duration = 0;