<XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
<XMI.exporterVersion>1.1</XMI.exporterVersion>
</XMI.documentation>
- <XMI.model xmi.name="album" href="/home/luca/website/www/test/bife/modules/album/album.xmi" />
+ <XMI.model xmi.name="album" href="/home/luca/website/www/test/bife/album/album.xmi" />
<XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
</XMI.header>
<XMI.content>
<li><b>desc:</b> Photo Description.</li>
<li><b>thumb:</b> Photo thumbnail filename.</li>
</ul>
-" name="getList" static="0" scope="202" />
- <UML:Operation stereotype="" package="" xmi.id="97" type="string" abstract="0" documentation="Creates an image thumbnail, returning his filename." name="makeThumb" static="0" scope="202" >
+" name="getList" static="0" scope="202" >
+ <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Directory where images are." name="root" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="2" value="" type="array" abstract="0" documentation="Images extensions to accept." name="exts" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="3" value="" type="string" abstract="0" documentation="Format to use to save the thumbs." name="format" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="4" value="" type="string" abstract="0" documentation="Directory where the thumbs are." name="thumbsdir" static="0" scope="200" />
+ </UML:Operation>
+ <UML:Operation stereotype="" package="" xmi.id="97" type="string" abstract="0" documentation="Creates an image thumbnail, returning his filename." name="makeThumb" static="1" scope="202" >
<UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Filename of the image to create the thumb." name="filename" static="0" scope="200" />
- <UML:Parameter stereotype="" package="" xmi.id="2" value="100" type="int" abstract="0" documentation="Maximum thumbnail size." name="size" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="3" value="" type="string" abstract="0" documentation="Thumbs format." name="format" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="4" value="" type="string" abstract="0" documentation="Directory where to put the thumbs." name="thumbsdir" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="5" value="" type="string" abstract="0" documentation="Root directory." name="root" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="6" value="100" type="int" abstract="0" documentation="Maximum thumbnail size." name="size" static="0" scope="200" />
</UML:Operation>
<UML:Operation stereotype="" package="" xmi.id="98" type="string" abstract="0" documentation="Returns the filename of an image thumb." name="getThumbFilename" static="0" scope="202" >
<UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Filename of the image to get the thumb name." name="filename" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="2" value="" type="string" abstract="0" documentation="Thumbs format." name="format" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="3" value="" type="string" abstract="0" documentation="Directory where the thumbs are." name="thumbsdir" static="0" scope="200" />
+ <UML:Parameter stereotype="" package="" xmi.id="4" value="" type="string" abstract="0" documentation="Root directory." name="root" static="0" scope="200" />
</UML:Operation>
<UML:Operation stereotype="" package="" xmi.id="102" type="string" abstract="0" documentation="Returns the description of the album." name="getDescription" static="0" scope="202" />
<UML:Operation stereotype="" package="" xmi.id="100" type="array" abstract="0" documentation="Splits a filename returning an array with the path, name and extension." name="splitFilename" static="1" scope="200" >
$cur = $row * $this->attrs['COLUMNS'] + $col;
if ($photo = @$list[$cur]) {
if (is_null($photo['THUMB'])) {
- $photo['THUMB'] = $this->makeThumb(
- BIFE_Link::getFsPath() . $photo['FILE'],
+ $photo['THUMB'] = $this->makeThumb($photo['FILE'],
$this->attrs['THUMBSFORMAT'],
- $this->attrs['THUMBSDIR']);
+ $this->attrs['THUMBSDIR'],
+ BIFE_Link::getFsPath() . $this->attrs['DIR']);
}
$photo['THUMB'] = BIFE_Link::getWebPath()
. $this->attrs['DIR'] . '/' . $photo['THUMB'];
<li><b>desc:</b> Photo Description.</li>
<li><b>thumb:</b> Photo thumbnail filename.</li>
</ul>
+ *
+ * @param string $root Directory where images are.
+ * @param array $exts Images extensions to accept.
+ * @param string $format Format to use to save the thumbs.
+ * @param string $thumbsdir Directory where the thumbs are.
*
* @return array
* @access protected
*/
- function getList() // ~X2C
+ function getList($root, $exts, $format, $thumbsdir) // ~X2C
{
$return = array();
$d = dir($root);
list($path, $name, $ext) = $this->splitFilename("$root/$file");
if (is_readable("$root/$file") and in_array($ext, $exts)) {
$thumb = $this->getThumbFilename($file, $format,
- $thumbsdir);
+ $thumbsdir, $root);
$return[] = array(
'FILE' => $file,
'DESC' => $name,
* Creates an image thumbnail, returning his filename.
*
* @param string $filename Filename of the image to create the thumb.
+ * @param string $format Thumbs format.
+ * @param string $thumbsdir Directory where to put the thumbs.
+ * @param string $root Root directory.
* @param int $size Maximum thumbnail size.
*
* @return string
* @access protected
+ * @static
*/
- function makeThumb($filename, $size = 100) // ~X2C
+ function makeThumb($filename, $format, $thumbsdir, $root, $size = 100) // ~X2C
{
- $thumb = $this->getThumbFilename($filename, $format, $thumbsdir);
- list($path, $name, $ext) = $this->splitFilename($thumb);
+ list($path, $name, $ext) = $this->splitFilename($filename);
$img =& Image_Transform::factory('GD');
- $img->load($filename);
+ $img->load("$root/$filename");
// If image is larger than the maximum size, we resize it.
if ($img->img_x > $size or $img->img_y > $size ) {
- if (!@is_dir($path) and !@mkdir($path)) {
+ if (!@is_dir("$root/$thumbsdir") and !@mkdir("$root/$thumbsdir")) {
return null;
}
if (PEAR::isError($img)) {
return null;
}
}
- $img->save("$path/$name.$format", $format);
+ $img->save("$root/$thumbsdir/$name.$format", $format);
$img->free();
-
- return $thumb;
+ return "$thumbsdir/$name.$format";
}
// -X2C
* Returns the filename of an image thumb.
*
* @param string $filename Filename of the image to get the thumb name.
+ * @param string $format Thumbs format.
+ * @param string $thumbsdir Directory where the thumbs are.
+ * @param string $root Root directory.
*
* @return string
* @access protected
*/
- function getThumbFilename($filename) // ~X2C
+ function getThumbFilename($filename, $format, $thumbsdir, $root) // ~X2C
{
list($path, $name, $ext) = $this->splitFilename($filename);
- return "$thumbsdir/$name.$format";
+ if (is_readable("$root/$thumbsdir/$name.$format")) {
+ return "$thumbsdir/$name.$format";
+ } else {
+ return null;
+ }
}
// -X2C
} // -X2C Class :Thumbs
-?>
\ No newline at end of file
+?>