in a good way).
- Added an example in a directory to test this.
- Smooth the path for a migration to an external lib that does the real work.
- Bugfixes.
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Page title="Hola mundo!" menu="true">
+ <Title>Datos!</Title>
+ <H3>Photo album</H3>
+ <Album:Thumbs dir="../images" columns="8"/>
+ <HR noshade="noshade" size="2"/>
+ <Link data-s="1" data-b="1">View BIFE (xbf) source</Link> |
+ <Link data-s="1">View PHP source</Link>
+</Page>
<Page title="Hola mundo!" menu="true">
<Title>Datos!</Title>
<H3>Photo album</H3>
<Page title="Hola mundo!" menu="true">
<Title>Datos!</Title>
<H3>Photo album</H3>
- <Album:Thumbs dir="../../.." columns="8"/>
+ <Album:Thumbs dir="images" columns="8"/>
<HR noshade="noshade" size="2"/>
<Link data-s="1" data-b="1">View BIFE (xbf) source</Link> |
<Link data-s="1">View PHP source</Link>
<HR noshade="noshade" size="2"/>
<Link data-s="1" data-b="1">View BIFE (xbf) source</Link> |
<Link data-s="1">View PHP source</Link>
<dep type="php" rel="ge">4.2.3</dep>
<dep type="pkg" rel="ge" version="1.0.0beta1">HTML_Template_HIT</dep>
<dep type="pkg" rel="ge" version="1.0.0beta1">BIFE</dep>
<dep type="php" rel="ge">4.2.3</dep>
<dep type="pkg" rel="ge" version="1.0.0beta1">HTML_Template_HIT</dep>
<dep type="pkg" rel="ge" version="1.0.0beta1">BIFE</dep>
- <dep type="pkg" rel="ge" version="1.0.0beta1">BIFE_Basic</dep>
+ <dep type="pkg" rel="ge" version="1.0.0beta3">BIFE_Basic</dep>
'EXTENSIONS' => 'png,jpg,jpeg,PNG,JPG,JPEG',
'MAXROWS' => 0,
'COLUMNS' => 4,
'EXTENSIONS' => 'png,jpg,jpeg,PNG,JPG,JPEG',
'MAXROWS' => 0,
'COLUMNS' => 4,
- 'LINK-BIFE' => 'photo.xbf',
- 'LINK-URL' => '',
);
$attrs = array_merge($defaults, $attrs);
$attrs['EXTENSIONS'] = explode(',', $attrs['EXTENSIONS']);
);
$attrs = array_merge($defaults, $attrs);
$attrs['EXTENSIONS'] = explode(',', $attrs['EXTENSIONS']);
function render(&$template) // ~X2C
{
$template->pushGroup('album');
function render(&$template) // ~X2C
{
$template->pushGroup('album');
- $list = $this->getList();
+ $list = $this->getList(BIFE_Link::getFsPath() . $this->attrs['DIR'],
+ $this->attrs['EXTENSIONS'], $this->attrs['THUMBSFORMAT'],
+ $this->attrs['THUMBSDIR']);
$tot = count($list);
$rows = ceil($tot / $this->attrs['COLUMNS']);
for ($row = 0; $row < $rows; $row++) {
$tot = count($list);
$rows = ceil($tot / $this->attrs['COLUMNS']);
for ($row = 0; $row < $rows; $row++) {
$cur = $row * $this->attrs['COLUMNS'] + $col;
if ($photo = @$list[$cur]) {
if (is_null($photo['THUMB'])) {
$cur = $row * $this->attrs['COLUMNS'] + $col;
if ($photo = @$list[$cur]) {
if (is_null($photo['THUMB'])) {
- $photo['THUMB'] = $this->makeThumb($photo['FILE']);
+ $photo['THUMB'] = $this->makeThumb(
+ BIFE_Link::getFsPath() . $photo['FILE'],
+ $this->attrs['THUMBSFORMAT'],
+ $this->attrs['THUMBSDIR']);
+ $photo['THUMB'] = BIFE_Link::getWebPath()
+ . $this->attrs['DIR'] . '/' . $photo['THUMB'];
$photo['URL'] = BIFE_Link::getURL(
array(
$photo['URL'] = BIFE_Link::getURL(
array(
- 'BIFE' => $this->attrs['LINK-BIFE'],
- 'URL' => $this->attrs['LINK-URL'],
- 'DATA-BIFE_ALBUM_FILE' => $photo['FILE'],
+ 'URL' => $this->attrs['LINK'],
+ 'DATA-BIFE_ALBUM_FILE' => BIFE_Link::getWebPath()
+ . $this->attrs['DIR'] . '/' . $photo['FILE'],
)
);
$cell = $template->parse('item', $photo);
)
);
$cell = $template->parse('item', $photo);
*/
function getList() // ~X2C
{
*/
function getList() // ~X2C
{
- $root = $this->attrs['DIR'];
- $exts = $this->attrs['EXTENSIONS'];
- $format = $this->attrs['THUMBSFORMAT'];
$return = array();
$d = dir($root);
if ($d) {
while (($file = $d->read()) !== false) {
list($path, $name, $ext) = $this->splitFilename("$root/$file");
if (is_readable("$root/$file") and in_array($ext, $exts)) {
$return = array();
$d = dir($root);
if ($d) {
while (($file = $d->read()) !== false) {
list($path, $name, $ext) = $this->splitFilename("$root/$file");
if (is_readable("$root/$file") and in_array($ext, $exts)) {
- $thumb = $this->getThumbFilename("$root/$file");
+ $thumb = $this->getThumbFilename($file, $format,
+ $thumbsdir);
- 'FILE' => "$root/$file",
- 'THUMB' => is_readable($thumb) ? $thumb : null,
*/
function makeThumb($filename, $size = 100) // ~X2C
{
*/
function makeThumb($filename, $size = 100) // ~X2C
{
- $format = $this->attrs['THUMBSFORMAT'];
- $thumb = $this->getThumbFilename($filename);
+ $thumb = $this->getThumbFilename($filename, $format, $thumbsdir);
list($path, $name, $ext) = $this->splitFilename($thumb);
$img =& Image_Transform::factory('GD');
$img->load($filename);
list($path, $name, $ext) = $this->splitFilename($thumb);
$img =& Image_Transform::factory('GD');
$img->load($filename);
*/
function getThumbFilename($filename) // ~X2C
{
*/
function getThumbFilename($filename) // ~X2C
{
- $root = $this->attrs['DIR'];
- $format = $this->attrs['THUMBSFORMAT'];
- $thumbsdir = $this->attrs['THUMBSDIR'];
-
list($path, $name, $ext) = $this->splitFilename($filename);
list($path, $name, $ext) = $this->splitFilename($filename);
-
- return "$root/$thumbsdir/$name.$format";
+ return "$thumbsdir/$name.$format";