Beispiel #1
0
<?php

include_once 'connection.php';
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
//Extract the content of image
$imageProperties = getimageSize($_FILES['image']['tmp_name']);
//Extract the mime type (filetype)
session_start();
if (!empty($_SESSION['userID'])) {
    if ($_SESSION['role'] == 'Local') {
        $sql = "INSERT INTO events (event_name_0, event_description, event_date, filetype, image)\n\t\t\tVALUES (:eventName, :eventDescription, :eventDate, '" . $imageProperties['mime'] . "', '" . $image . "')";
        try {
            $st = $conn->prepare($sql);
            $st->bindValue(":eventName", $_POST['event-name'], PDO::PARAM_STR);
            $st->bindValue(":eventDescription", $_POST['event-description'], PDO::PARAM_STR);
            $st->bindValue(":eventDate", strtotime($_POST["event-date"]), PDO::PARAM_STR);
            $st->execute();
        } catch (PDOException $e) {
            echo "Server Error - Try again!" . $e->getMessage();
        }
    } else {
        echo "You don't have the rights to create an event!";
    }
} else {
    echo "You shall not pass!";
}
$conn = null;
Beispiel #2
0
<?php

include 'connection.php';
$image = addslashes(file_get_contents($_FILES['user-picture']['tmp_name']));
//Extract the content of image
$imageProperties = getimageSize($_FILES['user-picture']['tmp_name']);
//Extract the mime type (filetype)
session_start();
if (!empty($_SESSION['userID'])) {
    if ($_SESSION['role'] == 'Tourist') {
        echo $_SESSION['loggedOn'] . $_SESSION['role'];
        $sql = "INSERT INTO postcards (userID, date, location, content, tags, type, title, picture, filetype)\n\t\t\tVALUES (:userID, :date, :location, :content, :tags, :type, :title,'" . $image . "','" . $imageProperties['mime'] . "')";
        try {
            $st = $conn->prepare($sql);
            $st->bindValue(":userID", $_SESSION['userID'], PDO::PARAM_INT);
            $st->bindValue(":date", date("Y-m-d H:i:s"), PDO::PARAM_STR);
            $st->bindValue(":location", $_POST["location"], PDO::PARAM_STR);
            $st->bindValue(":content", $_POST["content"], PDO::PARAM_STR);
            $st->bindValue(":tags", $_POST["tags"], PDO::PARAM_STR);
            $st->bindValue(":type", $_POST["type"], PDO::PARAM_STR);
            $st->bindValue(":title", $_POST["title"], PDO::PARAM_STR);
            $st->execute();
            echo "userID: " . $_SESSION['userID'] . " logged in? " . $_SESSION["loggedOn"];
        } catch (PDOException $e) {
            echo "Server Error - Try again!" . $e->getMessage();
        }
    } else {
        echo "You don't have the rights to create a postcard!";
    }
} else {
    echo "You shall not pass!";
            ?>
&sort=<?php 
            echo $sort;
            ?>
"><?php 
            echo i18n_get_translated($result[$x]['field' . $view_title_field]);
            ?>
</a><?php 
        }
        /* end hook replacepreviewalltitle */
        ?>
<br/><?php 
    }
    ?>
	<?php 
    $imageinfo = getimageSize($url);
    $imageheight = $imageinfo[1];
    ?>
    <?php 
    $flvfile = get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension);
    if (!file_exists($flvfile)) {
        $flvfile = get_resource_path($ref, true, "", false, $ffmpeg_preview_extension);
    }
    if (!(isset($resource['is_transcoding']) && $resource['is_transcoding'] == 1) && file_exists($flvfile) && strpos(strtolower($flvfile), "." . $ffmpeg_preview_extension) !== false) {
        # Include the Flash player if an FLV file exists for this resource.
        $download_multisize = false;
        if (!hook("customflvplay")) {
            include "flv_play.php";
            ?>
<br /><br /><?php 
        }
            ?>
&sort=<?php 
            echo urlencode($sort);
            ?>
"><?php 
            echo i18n_get_translated($result[$x]['field' . $view_title_field]);
            ?>
</a><?php 
        }
        /* end hook replacepreviewalltitle */
        ?>
<br/><?php 
    }
    ?>
	<?php 
    $imageinfo = getimageSize($path);
    $imageheight = $imageinfo[1];
    $modifiedurl = hook('previewallmodifyurl');
    if ($modifiedurl) {
        $url = $modifiedurl['url'];
        $imageheight = $modifiedurl['scr_height'];
        $border = true;
    }
    ?>
    <?php 
    $flvfile = get_resource_path($ref, true, "pre", false, $ffmpeg_preview_extension);
    if (!file_exists($flvfile)) {
        $flvfile = get_resource_path($ref, true, "", false, $ffmpeg_preview_extension);
    }
    if (!(isset($resource['is_transcoding']) && $resource['is_transcoding'] == 1) && file_exists($flvfile) && strpos(strtolower($flvfile), "." . $ffmpeg_preview_extension) !== false) {
        # Include the Flash player if an FLV file exists for this resource.
Beispiel #5
0
/**
 * 为一张图片添加上一个logo图片水印(以保存的方式实现)
 * @param string $picname 被处理图片源
 * @param string $logo 水印图片
 * @param string $pre 处理后图片名的前缀名
 * @return String 返回后的图片名称(带路径),如a.jpg=>n_a.jpg
 */
function imageUpdateLogo($picname, $logo, $pre = "n_")
{
    $picnameinfo = getimageSize($picname);
    //获取图片源的基本信息
    $logoinfo = getimageSize($logo);
    //获取logo图片的基本信息
    //var_dump($logoinfo);
    //根据图片类型创建出对应的图片源
    switch ($picnameinfo[2]) {
        case 1:
            //gif
            $im = imagecreatefromgif($picname);
            break;
        case 2:
            //jpg
            $im = imagecreatefromjpeg($picname);
            break;
        case 3:
            //png
            $im = imagecreatefrompng($picname);
            break;
        default:
            die("图片类型错误!");
    }
    //根据logo图片类型创建出对应的图片源
    switch ($logoinfo[2]) {
        case 1:
            //gif
            $logoim = imagecreatefromgif($logo);
            break;
        case 2:
            //jpg
            $logoim = imagecreatefromjpeg($logo);
            break;
        case 3:
            //png
            $logoim = imagecreatefrompng($logo);
            break;
        default:
            die("logo图片类型错误!");
    }
    //执行图片水印处理
    imagecopyresampled($im, $logoim, $picnameinfo[0] - $logoinfo[0], $picnameinfo[1] - $logoinfo[1], 0, 0, $logoinfo[0], $logoinfo[1], $logoinfo[0], $logoinfo[1]);
    //输出图像(根据源图像的类型,输出为对应的类型)
    $picinfo = pathinfo($picname);
    //解析源图像的名字和路径信息
    $newpicname = $picinfo["dirname"] . "/" . $pre . $picinfo["basename"];
    switch ($picnameinfo[2]) {
        case 1:
            imagegif($im, $newpicname);
            break;
        case 2:
            imagejpeg($im, $newpicname);
            break;
        case 3:
            imagepng($im, $newpicname);
            break;
    }
    //释放图片资源
    imagedestroy($im);
    imagedestroy($logoim);
    //返回结果
    return $newpicname;
}