コード例 #1
0
<?php

require '../inc/conf.php';
header('Cache-Control: no-cache');
set_time_limit(30);
ini_set("memory_limit", '64M');
$dir = ROOT_DIR . 'media/image/screenshot/';
$name = makeGuid(preg_replace('#(.+)\\.[a-zA-Z]+$#isU', '$1', $_FILES['Filedata']['name']));
$extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['Filedata']['name']));
$id = $db->insert('INSERT INTO map_image SET parent_id=' . $_POST['mapId'] . ', name="' . $name . '"');
$db->update('UPDATE map SET image_id=' . $id . ' WHERE id=' . $_POST['mapId']);
$image = $dir . 'original/' . $id . '.' . $extention;
if (file_exists($image)) {
    unlink($image);
}
move_uploaded_file($_FILES['Filedata']['tmp_name'], $image);
foreach ($IMAGE_SIZE as $size) {
    $size = explode('x', $size);
    $dest = $dir . $size[0] . (isset($size[1]) ? 'x' . $size[1] : '') . '/' . $id . '.jpg';
    if (file_exists($dest)) {
        unlink($dest);
    }
    redimage($image, $dest, $size[0], isset($size[1]) ? $size[1] : false);
}
redimage($image, ROOT_DIR . 'backoffice/img/preview/map_image_' . $id . '.jpg', 80, 80);
echo $id;
コード例 #2
0
ファイル: photo_upload.php プロジェクト: xpac27/terrificPics
<?php

require_once '../../conf/default.php';
require_once '../../conf/local.php';
require_once '../../inc/setup.php';
header('Content-Type: application/json; charset=utf-8');
header("Cache-Control: no-cache");
set_time_limit(120);
ini_set("memory_limit", '512M');
$id = $_POST['id'];
$folder = MEDIA_DIR . 'photo/';
$extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['Filedata']['name']));
$image = $folder . 'original/' . $id . '.' . $extention;
$sizeList = array('25x25', '0x500');
if (file_exists($image)) {
    unlink($image);
}
move_uploaded_file($_FILES['Filedata']['tmp_name'], $image);
foreach ($sizeList as $size) {
    $size = explode('x', $size);
    $dest = $folder . $size[0] . (isset($size[1]) ? 'x' . $size[1] : '') . '/' . $id . '.jpg';
    if (file_exists($dest)) {
        unlink($dest);
    }
    redimage($image, $dest, $size[0], isset($size[1]) ? $size[1] : false, true);
}
redimage($image, MEDIA_DIR . 'photo/120x120/' . $id . '.jpg', 120, 120, false);
echo '1';
コード例 #3
0
ファイル: upload.php プロジェクト: xpac27/BBack
<?php

require_once '../../../inc/conf.php';
header("Cache-Control: no-cache");
header("HTTP/1.0 200 OK");
set_time_limit(60);
ini_set("memory_limit", '64M');
if ($_GET['multipleFiles'] == 0) {
    include 'remove.php';
}
$name = makeGuid(preg_replace('#(.+)\\.[a-zA-Z]+$#isU', '$1', $_FILES['Filedata']['name']));
$id = $db->insert('INSERT INTO ' . $_GET['table'] . ' SET parent_id=' . $_GET['id'] . ', name="' . $name . '"');
$dir = ROOT_DIR . $_GET['folder'];
$sizeList = json_decode(stripslashes($_GET['size']));
$extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['Filedata']['name']));
$image = $dir . 'original/' . $id . '.' . $extention;
if (file_exists($image)) {
    unlink($image);
}
move_uploaded_file($_FILES['Filedata']['tmp_name'], $image);
foreach ($sizeList as $size) {
    $size = explode('x', $size);
    $dest = $dir . $size[0] . (isset($size[1]) ? 'x' . $size[1] : '') . '/' . $id . '.jpg';
    if (file_exists($dest)) {
        unlink($dest);
    }
    redimage($image, $dest, $size[0], isset($size[1]) ? $size[1] : false);
}
redimage($image, ROOT_DIR . 'img/preview/' . $_GET['table'] . '_' . $id . '.jpg', 80, 80);
echo $id;
コード例 #4
0
        if ($largeur_image_originale / $hauteur_image_originale > $largeur_max / $hauteur_max) {
            echo "WIDTH=" . $largeur_max . "px";
        } else {
            echo "HEIGHT=" . $hauteur_max . "px";
        }
    }
}
$url_avatar = "./images/avatars/" . $id_membre . ".gif";
if (!remote_file_exists($url_avatar)) {
    $url_avatar = "./images/avatars/no_avatar.png";
}
?>

<div style="float: left;height: 100px;padding-right: 10px;">
	<img src="<? echo $url_avatar ?>" <?php 
redimage($url_avatar, 100, 100);
?>
/>
</div>

<?php 
$queryInfosUser = "******";
$resultInfosUser = mysql_query($queryInfosUser) or die("probleme " . mysql_error());
if ($rowInfosUser = mysql_fetch_array($resultInfosUser)) {
    echo "<div>";
    echo "<div style=\"font-size: 13pt;font-weight: bold;padding-bottom: 5px;\">" . $rowInfosUser["pseudo"] . "</div>";
    echo "<div>" . $rowInfosUser["nom"] . " " . $rowInfosUser["prenom"] . "</div>";
    if ($rowInfosUser["ville"] != null) {
        echo "<div>" . $rowInfosUser["ville"] . " (" . $rowInfosUser["departement"] . ")</div>";
    }
    if ($rowInfosUser["url_logo"] != null) {