RSGallery2 Support Forums
Welcome, Guest. Please login or register.

Login with username, password and session length
  Home    Forum    Help    Search    Login    Register  
*
News : December 04, 2008, 08:34:06 pm
+  RSGallery2 Support Forums
|-+  RSgallery2 support forums
| |-+  Display and Templates (Moderators: Jonah, Tomislav Ribicic, Daniel Tulp, Ronald Smit)
| | |-+  class rsgGallery documentation?
Advanced search
  « previous next »
Pages 1
Author
Topic: class rsgGallery documentation?  (Read 3445 times)
« on: August 23, 2008, 06:12:44 pm »
cecil porter Offline
Newbie
*
Posts: 8



I'm using the following code to display the thumbs of all the galleries:

Code:
$top = rsgGalleryManager::get( 0 );

foreach( $top->kids() as $kid ){
    echo <<<EOD
    <br />
    {$kid->get('name')}
    <a xhref='{$kid->url}'>
    {$kid->thumbHTML}
    </a>
EOD;
}
 



I want to alter the html outputted by "thumbHTML".. specifically, I want to add an "id" and "title" field so I can turn those thumbs into javascript rollovers.  Is there a way to alter thumbHTML? or can someone point me to documentation on the various elements that contains so I can use them? (ie $kid->url)



The note at the bottom of the "accessing galleries" tutorial says,

Quote
Please see the API Documentation on class rsgGallery for more information.  Note that rsgGallery is not considered stable yet and might change in future versions.

..but I didn't find an entry for rsgGallery in the API Documentation.
Logged
 
Reply #1
« on: August 25, 2008, 10:08:28 am »
cecil porter Offline
Newbie
*
Posts: 8



should we just rename this area the "RSgallery2 lack-of-support forums" ?

insert emoticons indicating that I'm just kidding here:  Roll Eyes  Tongue  Grin

seriously, anyone have any advice?
Logged
 
Reply #2
« on: August 26, 2008, 09:57:36 pm »
Chef Groovy Offline
Dev Team
Full Member
*
Posts: 110

WWW

What exactly are you trying to do?  Get the image OF the gallery or an image FROM the gallery?
Logged

Chef Groovy
RSGallery2: Legacy - Dev
Test Site: dev.fantasyartwork.net
 
Reply #3
« on: August 27, 2008, 11:43:08 am »
cecil porter Offline
Newbie
*
Posts: 8



that code in my first post gets the thumb of each gallery and presents it as a linked image. I want to add a roll-over effect to those images. To do so, I need to add "id" and "title" fields to the <img> tag.

I see that thumbHTML seems to be generated in..

/administrator/components/com_rsgallery2/includes/gallery.class.php

..where it says:

Code:
$this->thumbHTML = "<div class=\"img-shadow\"><a href=\"".$this->url."\">".galleryUtils::getThumb( $this->get('id'),0,0,"" )."</a></div>";

..but it doesn't look like I can alter the <img> tag there.. and I'd rather edit the template files instead of the RSgallery2 back-end.

Is there another way to pull that thumb without using thumbHTML?

I've thought about using something like:
Code:
echo "<img src='". imgUtils::getImgThumb(???). "' width='55' height='55' border='1' id='"???"' name='"???"' />";

..but I'm not sure what should go where I've got Huh's.

Thanks for your response!
« Last Edit: August 27, 2008, 12:12:32 pm by cecil porter » Logged
 
Reply #4
« on: August 27, 2008, 12:06:25 pm »
Chef Groovy Offline
Dev Team
Full Member
*
Posts: 110

WWW

nothing wrong with editing the backside core, for some things you have to, I've raped and pillaged it haha
 Go ahead and change galleryUtils::getThumb and see if can get what you want. 

Or better yet, make a copy of function getThumb in the galleryUtils class called like getThumbExtended or something, that way can keep it seperate from the core, and for your own use.

Could you edit that last response and put in codeblock, got a lot of smileys and crap Smiley

btw- I'm actually working in galleryUtils and imgUtils as we speak, maybe will stumble on something

Logged

Chef Groovy
RSGallery2: Legacy - Dev
Test Site: dev.fantasyartwork.net
 
Reply #5
« on: August 27, 2008, 12:15:23 pm »
cecil porter Offline
Newbie
*
Posts: 8



where can I find galleryUtils::getThumb ?

thanks again
Logged
 
Reply #6
« on: August 27, 2008, 12:23:29 pm »
Chef Groovy Offline
Dev Team
Full Member
*
Posts: 110

WWW

its in the /administrator/rsgallery

in config.rsgallery2.php

search for "function getThumb"

around line 307 on mine, for what that worth, but I only mess with legacy version


Also, just so you know, it still uses imgUtils::getImgThumb to generate the thumbnail, thats where the real work is done
« Last Edit: August 27, 2008, 12:27:28 pm by Chef Groovy » Logged

Chef Groovy
RSGallery2: Legacy - Dev
Test Site: dev.fantasyartwork.net
 
Reply #7
« on: August 27, 2008, 04:01:20 pm »
cecil porter Offline
Newbie
*
Posts: 8



ahh, that's exactly what I needed! Thanks.

I have black and white versions of all my thumbs saved in the same directory as the full color thumbs.. with filenames ending with "-bw.jpg.jpg" - so now my gallery thumbnails are displayed in black and white and rollover to color versions of the same image.

in:
/administrator/components/com_rsgallery2/config.rsgallery2.php
..I duplicated function getThumb and changed it to:


Code:
function getThumbRollover($catid, $height = 0, $width = 0,$class = "") {
global $Itemid, $database, $mosConfig_live_site;

//Setting attributes for image tag
$imgatt="";
if ($height > 0) $imgatt .= " height=\"$height\" ";
if ($width > 0) $imgatt .=" width=\"$width\" ";
if ($class != "")
$imgatt .=" class=\"$class\" ";
else
$imgatt.=" class=\"rsg2-galleryList-thumb\" ";
//If no thumb, show default image.
if ( galleryUtils::getFileCount($catid) == 0 ) {
$thumb_html = "<img $imgatt src=\"".$mosConfig_live_site."/components/com_rsgallery2/images/no_pics.gif\" alt=\"No pictures in gallery\" />";
} else {
//Select thumb setting for specific gallery("Random" or "Specific thumb")
$sql = "SELECT thumb_id FROM #__rsgallery2_galleries WHERE id = '$catid'";
$database->setQuery($sql);
$thumb_id = $database->loadResult();
$list = galleryUtils::getChildList( $catid );
if ( $thumb_id == 0 ) {
//Random thumbnail
$sql = "SELECT name FROM #__rsgallery2_files WHERE gallery_id IN ($list) AND published=1 ORDER BY rand() LIMIT 1";
$database->setQuery($sql);
$thumb_name = $database->loadResult();
} else {
//Specific thumbnail
$thumb_name = galleryUtils::getFileNameFromId($thumb_id);
}
$thumby = imgUtils::getImgThumb($thumb_name);
$thumbles = galleryUtils::cutString($thumby);
$thumb_html = "<div class=\"img-shadow\"><a href=\"".$this->url."\" onmouseout=\"MM_swapImgRestore()\"
onmouseover=\"MM_swapImage('".$thumb_name."','','".$thumby."',1)\"><img $imgatt src=\"".$thumbles."-bw.jpg.jpg\" alt=\"$thumb_name\" id=\"$thumb_name\" name=\"$thumb_name\" /></a></div>";
}
return $thumb_html;

}

..and added a new function:

Code:
function cutString($str, $amount = 8, $dir = "right") {
  if(($n = strlen($str)) > 0) {
   if($dir == "right") {
    $start = 0;
    $end = $n-$amount;
   } elseif( $dir == "left") {
   $start = $amount;
   $end = $n;
   }

  return substr($str, $start, $end);
  } else return false;
}


then I changed the definition of "thumbHTML" in:
/administrator/components/com_rsgallery2/includes/gallery.class.php

from:
Code:
$this->thumbHTML = "<div class=\"img-shadow\"><a href=\"".$this->url."\">".galleryUtils::getThumb( $this->get('id'),0,0,"" )."</a></div>";

to:
Code:
$this->thumbHTML = galleryUtils::getThumbRollover( $this->get('id'),0,0,"" );


I'm using the Macromedia rollover functions in the Joomla html template:

Code:
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

Thanks Chef Groovy!
Logged
 
Reply #8
« on: August 27, 2008, 06:47:25 pm »
Chef Groovy Offline
Dev Team
Full Member
*
Posts: 110

WWW

Cool beans.  Glad got it figured out

Whats your site so can see it in action?
Logged

Chef Groovy
RSGallery2: Legacy - Dev
Test Site: dev.fantasyartwork.net
 
Reply #9
« on: October 07, 2008, 02:17:31 pm »
cecil porter Offline
Newbie
*
Posts: 8



http://norrisarchitecture.com/

under "projects"

thanks again for all your help!
Logged
 
Print  Pages 1
« previous next »
Jump to: