Exemplo n.º 1
0
 function __construct()
 {
     $dal = DAL::getDAL();
     $this->numComments = $dal->getNumComments($this->title);
     if ($this->redirectType == "Play") {
         $this->url = "#view/{$this->title}/{$this->redirect}";
     } else {
         if ($this->redirect != null) {
             $this->url = $this->redirect;
         }
     }
     $this->images = $dal->getImagesForPost($this->title);
     $this->urls = $dal->getUrlsForPost($this->title);
 }
Exemplo n.º 2
0
    $filename = substr(md5(time() . $i++), -6) . '.png';
    $filepath = "{$path}{$filename}";
} while (file_exists($filepath));
// Move the file. If moving the file fails, abort.
if (!move_uploaded_file($_FILES['imagedata']['tmp_name'], $filepath)) {
    echo $uri, 'error.png';
    exit;
}
// Compress the image (destroying any alpha transparency).
$image = @imagecreatefrompng($filepath);
imagepng($image, $filepath, 9);
imagedestroy($image);
// Return the image URI.
echo $uri, $filename;
include 'routes/DAL.php';
$dal = DAL::getDAL();
$dal->writeImage($filename);
$newFileName = "./thumbs/" . $filename;
$fileName = "./grab/" . $filename;
list($width, $height) = getimagesize($fileName);
if ($width < $height) {
    $newheight = 250;
    $newwidth = floor($width * ($newheight / $height));
} else {
    $newwidth = 250;
    $newheight = floor($height * ($newwidth / $width));
}
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefrompng($fileName);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagepng($thumb, $newFileName);