1
|
|
|
<? |
|
|
|
|
2
|
|
|
|
3
|
|
|
Loader::load('controller', 'portfolio/DefaultPageController'); |
4
|
|
|
|
5
|
|
|
final class PieceController extends DefaultPageController |
6
|
|
|
{ |
7
|
|
|
|
8
|
|
|
private $title_url; |
9
|
|
|
|
10
|
|
|
function __construct() |
|
|
|
|
11
|
|
|
{ |
12
|
|
|
parent::__construct(); |
13
|
|
|
|
14
|
|
|
$this->title_url = URLDecode::getPiece(2); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
protected function set_data() |
18
|
|
|
{ |
19
|
|
|
$this->set_title("Jacob Emerick's Portfolio"); |
20
|
|
|
$this->set_head('description', "Jacob Emerick's Portfolio - examples of my work ranging from early print design to current web projects"); |
21
|
|
|
$this->set_head('keywords', 'portfolio, Jacob Emerick, print design, examples, advertising, marketing campaigns, freelance, graphic design'); |
22
|
|
|
|
23
|
|
|
$this->set_body('body_view', 'Piece'); |
24
|
|
|
$this->set_body('left_side_data', array( |
25
|
|
|
'title' => "Print Gallery | Jacob Emerick's Portfolio", |
26
|
|
|
'menu' => $this->get_menu(), |
|
|
|
|
27
|
|
|
'home_link' => Loader::getRootURL())); |
28
|
|
|
$this->set_body('body_data', $this->get_piece_data()); |
29
|
|
|
|
30
|
|
|
$this->set_body_view('Page'); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
private function get_piece_data() |
34
|
|
|
{ |
35
|
|
|
Loader::load('collector', 'portfolio/PortfolioCollector'); |
36
|
|
|
$portfolio_result = PortfolioCollector::getPieceByURI($this->title_url); |
37
|
|
|
|
38
|
|
|
if($portfolio_result === null) |
39
|
|
|
$this->eject(); |
40
|
|
|
|
41
|
|
|
$portfolio_image_result = PortfolioCollector::getImagesForPiece($portfolio_result->id, 2); |
42
|
|
|
|
43
|
|
|
$image_path = "portfolio/{$portfolio_image_result[0]->name}"; |
44
|
|
|
$image_path = Loader::getImagePath('image', $image_path); |
45
|
|
|
$image_size = getimagesize($image_path); |
46
|
|
|
|
47
|
|
|
$main_image = new stdclass(); |
48
|
|
|
$main_image->id = $portfolio_image_result[0]->id; |
49
|
|
|
$main_image->link = "/image/portfolio/{$portfolio_image_result[0]->name}"; |
50
|
|
|
|
51
|
|
|
$main_image->width = $image_size[0]; |
52
|
|
|
$main_image->height = $image_size[1]; |
53
|
|
|
|
54
|
|
|
foreach($portfolio_image_result as $portfolio_image) |
|
|
|
|
55
|
|
|
{ |
56
|
|
|
$thumb = $portfolio_image->name; |
57
|
|
|
$thumb_array = explode('.', $thumb); |
58
|
|
|
$thumb = "{$thumb_array[0]}_clip.{$thumb_array[1]}"; |
59
|
|
|
|
60
|
|
|
$image_path = "portfolio/{$thumb}"; |
61
|
|
|
$image_path = Loader::getImagePath('image', $image_path); |
62
|
|
|
$image_size = getimagesize($image_path); |
63
|
|
|
|
64
|
|
|
$image_obj = new stdclass(); |
65
|
|
|
$image_obj->id = $portfolio_image->id; |
66
|
|
|
$image_obj->link = "/image/portfolio/{$thumb}"; |
67
|
|
|
|
68
|
|
|
$image_obj->width = $image_size[0]; |
69
|
|
|
$image_obj->height = $image_size[1]; |
70
|
|
|
|
71
|
|
|
$image_array[] = $image_obj; |
|
|
|
|
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
$portfolio_tag_result = PortfolioCollector::getTagsForPiece($portfolio_result->id); |
75
|
|
|
|
76
|
|
|
foreach($portfolio_tag_result as $portfolio_tag) |
|
|
|
|
77
|
|
|
{ |
78
|
|
|
$tag_array[] = $portfolio_tag->name; |
|
|
|
|
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
return array( |
82
|
|
|
'title' => $portfolio_result->title, |
83
|
|
|
'description' => $portfolio_result->description, |
84
|
|
|
'thumbs' => $image_array, |
|
|
|
|
85
|
|
|
'image' => $main_image, |
86
|
|
|
'tags' => $tag_array); |
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
} |
90
|
|
|
|
Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.
As a precaution to avoid these problems better use the long opening tag
<?php
.