function setimagesize($imagefile, $width = false, $height = false) {
		if (class_exists('Imagick')) {
			$im = new Imagick();
			$im->setResolution( 300, 300 );
			$im->readImage($imagefile);
		}
		$attr = imgetimagesize($imagefile);
		list($image_width, $image_height, $image_type, $image_attr) = $attr;
		if (!$width && !$height) { return $attr; }
		if (!$height) { $height = round(($image_height * $width) / $image_width); }
		if (!$width) { $width = round(($image_width * $height) / $image_height); }
		return array($width, $height, $image_type, "width=\"$width\" height=\"$height\"");
	}
Ejemplo n.º 2
0
$ignore_filenames = array('DS_Store');
$existings = $db->query("SELECT * FROM `photos`");
$existing_files = array();
while ($existing = $existings->fetch_assoc()) {
    $existing_files[] = $existing['fullpath'];
}
$files = getAllFiles("./content/");
$starttime = time();
echo "<pre>Started at: " . date("Y-m-d H:i:s", $starttime) . ' ' . count($files) . " files</pre>";
$i = 0;
foreach ($files as $key => $file) {
    $f_info = pathinfo($file);
    $f_ext = trim(strtolower($f_info['extension']));
    if (!in_array($file, $existing_files) && substr($f_info['basename'], 0, 1) !== '.' && in_array($f_ext, $filetypes) && !in_array($f_info['basename'], $ignore_filenames)) {
        try {
            $imagesize = imgetimagesize($file);
        } catch (Exception $e) {
            echo "<pre>Error with file: {$file}\nSize:" . filesize($file) . "\nCaught exception: " . $e->getMessage() . "</pre>";
        }
        if (isset($imagesize['properties']['tiff:timestamp'])) {
            $filedate = strtotime($imagesize['properties']['tiff:timestamp']);
        } elseif (isset($imagesize['properties']['xap:CreateDate'])) {
            $filedate = strtotime($imagesize['properties']['xap:CreateDate']);
        } elseif (isset($imagesize['properties']['xmp:CreateDate'])) {
            $filedate = strtotime($imagesize['properties']['xmp:CreateDate']);
        } elseif (isset($imagesize['properties']['date:create'])) {
            $filedate = strtotime($imagesize['properties']['date:create']);
        } else {
            $filedate = filemtime($file);
        }
        $image_info = array("fullpath" => $file, "file" => $f_info['basename'], "path" => $f_info['dirname'], "name" => $f_info['filename'], "time" => date('Y-m-d H:i:s', $filedate), "type" => $f_ext, "mimetype" => $imagesize['mime_type'], "copyright" => '', "photographer" => '', "width" => $imagesize['width'], "height" => $imagesize['height'], "xresolution" => $imagesize['resolution_x'], "yresolution" => $imagesize['resolution_y'], "created" => date("Y-m-d H:i:s"), "updated" => date("Y-m-d H:i:s"));
Ejemplo n.º 3
0
function setimagesize($imagefile, $width = false, $height = false)
{
    global $enable_imagick;
    if ($enable_imagick && class_exists('Imagick')) {
        $im = new Imagick();
        $im->setResolution(300, 300);
        $im->readImage($imagefile);
    }
    $attr = imgetimagesize($imagefile);
    if (!$width && !$height) {
        return $attr;
    }
    if (!$height) {
        $height = round($attr['height'] * $width / $attr['width']);
    }
    if (!$width) {
        $width = round($attr['width'] * $height / $attr['height']);
    }
    return array("width" => $width, "height" => $height, "type" => $attr['type'], "attr" => "width=\"{$width}\" height=\"{$height}\"");
}
Ejemplo n.º 4
0
	function display_file($filesource, $mimetype = false) {
		global $debug;
		$f_info = pathinfo($filesource);
		$f_ext = trim(strtolower($f_info['extension']));
		if (!$mimetype) {
			$mimetype = ext_from_mimetype($s_ext, true);
			if (empty($mimetype)) {
				$isize = imgetimagesize($filesource);
				$mimetype = $isize['mimetype'];
			}
		}
		if ($debug) {
			echo "<pre>Filesource: $filesource\nSource Extension: $s_ext\nMimeType: $mimetype</pre>";
		} else {
			header('Content-Type: '. $mimetype);
			readfile($filesource);
		}
	}
Ejemplo n.º 5
0
<?
	require_once("config.inc.php");
	
	$terms = $_COOKIE['pl_terms'];
	
	$id = intval($_GET['id']);
	$photo = $db->query("SELECT * FROM `photos` WHERE `id` = $id")->fetch_assoc();
	
	$exifdata = imgetimagesize($photo['fullpath']);
	
	$a_filetypes = $db->query("SELECT DISTINCT `type` FROM `photos` ORDER BY `type`");
?>
<!DOCTYPE html>
<html lang="en"><!-- InstanceBegin template="/Templates/art-pages.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <!-- InstanceBeginEditable name="doctitle" -->
    <title><?php 
echo $photo['name'];
?>
 | DairyBusiness Stock Artwork</title>
    <!-- InstanceEndEditable -->
  <!-- Bootstrap -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha256-k2/8zcNbxVIh5mnQ52A0r3a6jAgMGxFJFE2707UxGCk= sha512-ZV9KawG2Legkwp3nAlxLIVFudTauWuBpC10uEafMHYL0Sarrz5A7G79kXh5+5+woxQ5HM559XX2UZjMJ36Wplg==" crossorigin="anonymous">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->