function __construct($row)
 {
     $this->row = $row;
     // bind db row to this object
     foreach ($row as $k => $v) {
         $this->{$k} = $row[$k];
     }
     $this->params = $this->explode_assoc("=", "\n", $this->params);
     $this->thumb();
     //Write status icons
     $this->status = galleryUtils::writeGalleryStatus($this);
     //Write owner name
     $this->owner = galleryUtils::genericGetUserName($this->get('uid'));
     //Write gallery name
     $this->url = JRoute::_("index.php?option=com_rsgallery2&gid=" . $this->get('id'));
     $this->galleryName = htmlspecialchars(stripslashes($this->get('name')));
     //Write HTML for thumbnail
     $this->thumbHTML = "<div class=\"img-shadow\"><a href=\"" . $this->url . "\">" . galleryUtils::getThumb($this->get('id'), 0, 0, "") . "</a></div>";
     //Write description
     jimport('joomla.filter.output');
     $this->description = JFilterOutput::ampReplace($this->get('description'));
 }
        // Create HTML for image: get the url (with/without watermark) with img attributes
        if ($displayType == 1) {
            // *** display ***:
            $watermark = $rsgConfig->get('watermark');
            //$imageUrl = $watermark ? waterMarker::showMarkedImage( $ItemIdxName ) : imgUtils::getImgDisplayPath( $ItemIdxName );
            $imageUrl = $watermark ? waterMarker::showMarkedImage($ItemIdxName) : imgUtils::getImgDisplay($ItemIdxName);
            $HTML = '<img class="rsg2-displayImage" src="' . $imageUrl . '" alt="' . $ItemIdxName . '" title="' . $ItemIdxName . '" ' . $imgAttributes . '/>';
        } elseif ($displayType == 2) {
            // *** original ***
            $watermark = $rsgConfig->get('watermark');
            //$imageOriginalUrl = $watermark ? waterMarker::showMarkedImage( $ItemIdxName, 'original' ) : imgUtils::getImgOriginalPath( $ItemIdxName );
            $imageOriginalUrl = $watermark ? waterMarker::showMarkedImage($ItemIdxName, 'original') : imgUtils::getImgOriginal($ItemIdxName);
            $HTML = '<img class="rsg2-displayImage" src="' . $imageOriginalUrl . '" alt="' . $ItemIdxName . '" title="' . $ItemIdxName . '" ' . $imgAttributes . '/>';
        } else {
            // *** thumb ***
            $HTML = galleryUtils::getThumb($gallery->get('id'), $imageHeight, $imageWidth, "mod_rsgallery2_latest_galleries_img");
            // thumbid, height, width, class
        }
        $name = $gallery->name;
        $date = $gallery->date;
        // Show it
        ?>
				<div class="mod_rsgallery2_latest_galleries_attributes" <?php 
        echo $divAttributes;
        ?>
>
					<div class="mod_rsgallery2_latest_galleries-cell">
						<a href="<?php 
        echo $gallery->url;
        ?>
">