PDA

Zobacz pełną wersję : Moduł z obrazkami



wampir666
29-11-2008, 13:15
Chciałbym aby wyświetlało mi określoną liczbę zdjęć w module z galerii, oraz określonego z góry rozmiaru. (Aby wszystkie były równe sobie rozmiarem).

Czy jest jakiś moduł ? Znalazłem tylko, który losowo wyświetla obrazek, ale nie wiem jak tam ustalić by był jednakowy rozmiar dla wszystkich i by wyświetlał więcej zdjęć... wygląda tak:


<?php
/* $Id: mod_randompony.php,v 1.4 2006/02/03 14:13:28 gizmola Exp $ */
/**
* Random Pony Module
* @package Mambo Open Source
* @Copyright (C)
* @ All rights reserved
* @ Mambo Open Source is Free Stuff
* @ Released under GNU GPL License
* @version $Add On
* @Revision Date : 12.04.2005
* Changed by Yana Pazyna
* @Revision Date : 01.30.2006
* Revised by David Rolston for PonyGallery 1.15
**/

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/**
* function getCats
* Take the catid string param, and insure it's valid.
* If it's empty, then return a null string.
*/
function getCats($catid) {
$catids = explode(',', $catid);
if ($catids) {
$catidss = '';
foreach ($catids as $key => $value) {
$catids[$key] = (int)$value;
if ($catids[$key] > 0) {
$catidss .= $catids[$key] . ',';
}
}
// Strip off the trailing comma if needed
if ($catidss{strlen($catidss) - 1} == ',')
$catidss = substr($catidss, 0, -1);
return $catidss;
} else {
// if string is empty explode returns false
return $catids;
}
}

$class_sfx = $params->get('moduleclass_sfx');
$itemid = (int)$params->get('Itemid', 1);
$catid = getCats(trim( $params->get('catidlist'))); //Images only from these categories [comma seperated list]
$title = (int)$params->get('showtitle', 1); // Show image title
$author = (int)$params->get('showauthor', 1); // Show image author
$text = (int)$params->get('showtext', 1); // Show image description

require($mainframe->getCfg( 'absolute_path' )."/administrator/components/com_ponygallery/config.ponygallery.php");
$picturepath = $mosConfig_live_site . $ag_pathimages . '/';
$thumbnailpath = $mosConfig_live_site . $ag_paththumbs . '/';

$query = "SELECT *,c.access
FROM #__ponygallery as p
LEFT JOIN #__ponygallery_catg as c
on c.cid = p.catid
WHERE p.published = '1'
AND p.approved=1
AND c.access <= $my->gid";
$query .= ($catid) ? " AND p.catid IN ($catid) " : ' ';
$query .= 'ORDER BY RAND() LIMIT 1';

$database->setQuery($query);
$rows = $database->loadObjectList();
$row = $rows[0];

echo "<div id='pony'>";
if (count($row) > 0) {
echo "<a href='index.php?option=com_ponygallery&func=detail&Itemid=$itemid&id=$row->id' class='pony_img'>
<img src='$thumbnailpath$row->imgthumbname' border='none' class='pony_img'></a><br />";

if ($title == 1) {
echo "<span class='pony_title'><a href='index.php?option=com_ponygallery&func=detail&Itemid=$itemid&id={$row->id}' class='pony_img'>{$row->imgtitle}</a></span><br />";
}
if ($author == 1) {
$row->imgauthor = trim($row->imgauthor);
if (!empty($row->imgauthor)) {
echo "<span class='pony_author'>{$row->imgauthor}</span><br />";
} else {
echo "<span class='pony_author'>{$row->owner}</span><br />";
}
}
if ($text == 1) {
echo "<span class='pony_text'>{$row->imgtext}</span>";
}
} else {
echo "Nie znaleziono zdjęć.";
}
echo "</div>";
?>