Commit 04a4286a authored by mose's avatar mose

ported cache of topic_image to article_image

parent e0610421
<?php
// $Header: /cvsroot/tikiwiki/tiki/article_image.php,v 1.4 2003-11-11 21:27:21 dheltzel Exp $
// $Header: /cvsroot/tikiwiki/tiki/article_image.php,v 1.5 2003-11-23 22:48:58 mose Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
# $Header: /cvsroot/tikiwiki/tiki/article_image.php,v 1.4 2003-11-11 21:27:21 dheltzel Exp $
# $Header: /cvsroot/tikiwiki/tiki/article_image.php,v 1.5 2003-11-23 22:48:58 mose Exp $
// application to display an image from the database with
// option to resize the image dynamically creating a thumbnail on the fly.
......@@ -14,13 +14,31 @@ if (!isset($_REQUEST["id"])) {
die;
}
include_once ('db/tiki-db.php');
include_once ('lib/tikilib.php');
$tikilib = new Tikilib($dbTiki);
$data = $tikilib->get_article($_REQUEST["id"]);
$type = $data["image_type"];
//$data = $data["image_data"];
$topiccachefile = "temp" . "/article.".$_REQUEST["id"];
if (is_file($topiccachefile) and (!isset($_REQUEST["reload"]))) {
$size = getimagesize($topiccachefile);
header ("Content-type: ".$size['mime']);
readfile($topiccachefile);
} else {
include_once ('db/tiki-db.php');
include_once ('lib/tikilib.php');
$tikilib = new Tikilib($dbTiki);
$data = $tikilib->get_topic_image($_REQUEST["id"]);
$type = $data["image_type"];
$data = $data["image_data"];
if ($data["image_data"]) {
$fp = fopen($topiccachefile,"wb");
fputs($fp,$data);
fclose($fp);
}
}
header ("Content-type: $type");
echo $data["image_data"];
if (is_file($topiccachefile)) {
readfile($topiccachefile);
} else {
echo $data;
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment