<?php

class VstImagenPublica {
	
	protected $fichero;
	protected $class;
	protected $id;
	protected $atributos;
	protected $alt;
	protected $title;
	protected $ruta;
	
	public function __construct($fichero, $alt = '', $id = '', $class = '', $title='', $atributos = array()) {
		$this->fichero = $fichero;
		$this->alt = $alt;
		$this->id = $id;
		$this->atributos = $atributos;
		$this->class = $class;
		$this->title = $title;
		$this->ruta = PUBLICURL.'/img/';
		
	}
	
	public function render(){
		
		$alt = (($this->alt)?' alt="'.$this->alt.'" ':'');
		$title = (($this->title)?' alt="'.$this->title.'" ':'');
		$id = (($this->id)?' id="'.$this->id.'" ':'');
		$class = (($this->class)?' class="'.$this->class.'" ':'');
		
		/*
		 * TODO: Falta atributos 
		 * */
		
	-	$html = '<img src="'.$this->ruta.$this->fichero.'" '.$id.$class.$alt.$title.'></img>';
		return $html;
	}
	
	public function __toString(){
		return $this->render();
	}
	
}