/** * Construction method for the Image class * * @access public * @param Wiki &$wikiClass The Wiki class object * @param string $title The title of the image * @param int $pageid The ID of the image page (optional) * @return Image */ public function __construct(Wiki &$wikiClass, $title = null, $pageid = null) { $this->wiki =& $wikiClass; $this->title = $title; if ($this->wiki->removeNamespace($title) == $title) { $namespaces = $this->wiki->get_namespaces(); $this->title = $namespaces[6] . ':' . $title; } $ii = $this->imageinfo(); if (is_array($ii)) { $this->title = $ii[0]['canonicaltitle']; $this->rawtitle = $this->wiki->removeNamespace($this->title); $this->localname = str_replace(array(' ', '+'), array('_', '_'), urlencode($this->rawtitle)); $this->page =& $this->wiki->initPage($this->title, $pageid); $this->mime = $ii[0]['mime']; $this->bitdepth = $ii[0]['bitdepth']; $this->hash = $ii[0]['sha1']; $this->size = $ii[0]['size']; $this->width = $ii[0]['width']; $this->height = $ii[0]['height']; $this->url = $ii[0]['url']; $this->timestamp = $ii[0]['timestamp']; $this->user = $ii[0]['user']; if (is_array($ii[0]['metadata'])) { foreach ($ii[0]['metadata'] as $metadata) { $this->metadata[$metadata['name']] = $metadata['value']; } } else { $this->exists = false; } } }