diff app/controllers/icon_controller.php @ 3:7201fd354bdf

added icon features , default icon
author Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
date Sun, 14 Aug 2011 23:52:31 +0900
parents
children c3adb28473d6
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controllers/icon_controller.php	Sun Aug 14 23:52:31 2011 +0900
@@ -0,0 +1,39 @@
+<?php
+
+class IconController extends AppController
+{
+	public $name = "icon";
+	public $autoRender = false;
+	public $uses = null;
+
+	public function index()
+	{
+		$icon_dir = "../icon"; //relative path without slash
+		$this->autoRender = false;
+		$icon_default = "/default.png"; //file name must include slash
+		$icon_file = $icon_default;
+
+		if(isset($this->params["url"]["uuid"])){
+			$icon_file = "/".$this->params["url"]["uuid"]."png";
+		}
+
+		$icon = @file_get_contents($icon_dir.$icon_file);
+		if($icon === FALSE){
+			//failed to get icon
+			$icon = file_get_contents($icon_dir.$icon_default);
+		}
+
+		header("Content-Type: image/png");
+		print($icon);
+	}
+
+	public function EditIcon()
+	{
+	}
+
+	public function SaveIcon()
+	{
+	}
+}
+
+?>