comparison 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
comparison
equal deleted inserted replaced
2:bea0f05fb3c8 3:7201fd354bdf
1 <?php
2
3 class IconController extends AppController
4 {
5 public $name = "icon";
6 public $autoRender = false;
7 public $uses = null;
8
9 public function index()
10 {
11 $icon_dir = "../icon"; //relative path without slash
12 $this->autoRender = false;
13 $icon_default = "/default.png"; //file name must include slash
14 $icon_file = $icon_default;
15
16 if(isset($this->params["url"]["uuid"])){
17 $icon_file = "/".$this->params["url"]["uuid"]."png";
18 }
19
20 $icon = @file_get_contents($icon_dir.$icon_file);
21 if($icon === FALSE){
22 //failed to get icon
23 $icon = file_get_contents($icon_dir.$icon_default);
24 }
25
26 header("Content-Type: image/png");
27 print($icon);
28 }
29
30 public function EditIcon()
31 {
32 }
33
34 public function SaveIcon()
35 {
36 }
37 }
38
39 ?>