id = $row['image_id'];
$this->path = $row['image_path'];
$this->name = $row['image_name'];
$this->albumId = $row['album_id'];
$this->title = htmlentities($row['image_title'], ENT_QUOTES);
$this->caption = $row['image_caption'];
$this->caption_safe = htmlentities(strip_tags($row['image_caption']), ENT_QUOTES);
$this->creationDate = $row['creationDate'];
$this->modificationDate = $row['modificationDate'];
$this->make = $row['make'];
$this->model = $row['model'];
$this->lens = $row['lens'];
$this->aperture = $row['aperture'];
$this->focalLength = $row['focalLength'];
$this->exposureTime = $row['exposureTime'];
$this->sensitivity = $row['sensitivity'];
$this->meteringMode = $row['meteringMode'];
$this->latitude = $row['latitudeNumber'];
$this->longitude = $row['longitudeNumber'];
}
public function getTitle ( ) {
if( $this->title != "" ) return $this->title;
if( $this->name != "" ) return $this->name;
return "Photo";
}
public function getTitleWithTags ( $tags ) {
$imageUrl = $this->getUrlForSize( "" );
$returnValues = "
";
$returnValues .= "";
if( count($tags) ) {
$returnValues .= "
Tags:
";
foreach ( $tags as $tag ) {
$returnValues .= "
- {$tag->name}";
}
$returnValues .= "
";
}
$imagePageUrl = $this->getPageUrl();
$returnValues .= "
";
return htmlentities( $returnValues, ENT_QUOTES );
}
public function getUrlForSize ( $size ) {
$image_path = $this->path . "/" . $this->name;
if ( $size != "" ) {
$image_base = "/pics/thumbnails";
$size = "-$size";
} else {
$image_base = "/pics/photos";
}
return $image_base . \
str_replace("'", "'",
str_replace(".jpg", "$size.JPG",
str_replace(".JPG", "$size.JPG",
str_replace(" ", "%20", $image_path))));
}
public function getAsJson() {
$imageUrl = $this->getUrlForSize( "1024x768" );
$imageTitleWithTags = $this->getTitle();
$to_replace_from = array( '\n', '"');
$to_replace_to = array( ' ', '"');
$imageTitleWithTags = str_replace($to_replace_from, $to_replace_to, $imageTitleWithTags);
$imageTitleWithTags = preg_replace("/\n/", " ", $imageTitleWithTags);
return " {
\"href\": \"$imageUrl\",
\"title\": \"$imageTitleWithTags\",
\"caption\": \"$imageTitleWithTags\"
}";
}
public function getPageUrl() {
return "/pics/pic.php?image=$this->id";
}
}
?>