modify slideshowblock

Permalink
hello,

I try a to build a slideschow block suit my needs. The idea is, to select a picture and with an appropriate search pattern find a picture with a different aspect ratio in the File database.

At this moment I was hanging down in the following problem.

If you modify image_row_include.php at line 4 with this snippet:
<?php echo '-->' .$imgInfo['fileName'] .'<--'; ?>
you can show the Filename of the current picture. I would like to use these filename to generate a data base query individually. Here is the code to do so.
<?php            
echo '-->' .$imgInfo['fileName'] .'<--';
$db = Loader::db();
$query = sprintf("SELECT * FROM FileVersions WHERE fvTitle = '%s' ORDER BY fvID DESC LIMIT 1", 
         mysql_real_escape_string(  $imgInfo['fileName'] ));
$r = $db->query($query);            
print_r($r->FetchObject());
?>


The query itself works in myphpadmin. In the database if I am looking for "test.png", then I get a result
SELECT * FROM FileVersions WHERE fvTitle = 'test.png' ORDER BY fvID DESC LIMIT 1

But it seems that the variable ($imgInfo['fileName']) is survived not so long or overwritten by the controller. If I use this variable in the database search, then I find nothing every time. What troubles me is the filename of the output correctly.

Can any one help? Thanks

wrongspot
 
Fernandos replied on at Permalink Reply
Fernandos
Intersting way to solve that problem. You're trying to find images with aspect ratios to make the images fit to your slideshow, right?

If yes, you're overcomplicating stuff. You can go two different ways.

1. Add a hook into to the filemanager, so that files with the mimetype of an image get analyzed by a script like thishttp://bit.ly/bShHXg it's a simple math calculation.

2. The far better way (not in the long term) is to usehttp://bit.ly/bShHXg to resize the images before outputting them, so that even images with a wrong aspect ration can be viewed as long as they have a minimum height and width.

Grüße
Fernandos