Live Support, Chat and HTML Editor
Welcome to Support forums Sign in | Join | Help Messenger
in Search

Image Categories Help

Last post 09-23-2010, 2:59 PM by Adam. 4 replies.
Sort Posts: Previous Next
  •  09-01-2010, 7:40 PM 63801

    Image Categories Help

    How do I call different categories with php gallery using the links?
     
    I have 3 categories I am testing the DEMO with however no matter what I use to call the page, all the images from all 3 categories are showing.
     
    http://www.domain.com/gallery/Test/index.php?cat=1
    http://www.domain.com/gallery/Test/index.php?cat=Models
     
    So far nothing I have attempted has worked. Not understanding the benefit of having categories if they can not be accessed singly. 
     
    Other than this issue I am impressed with the software and would like to purchase it, however without a way to call the categories separately via href link I'm afraid that this software does me no good.
     
     
  •  09-14-2010, 6:12 PM 64013 in reply to 63801

    Re: Image Categories Help

    Anyone?
  •  09-23-2010, 2:57 PM 64169 in reply to 63801

    Re: Image Categories Help

    DAPLV,
     
    You can use GalleryFolder properrty to set image directory dynamically.
     
    $gallery->GalleryFolder="defaultalbum"; //the path to the image directory
     

    >>How do I call different categories with php gallery using the links?

    Step 1. Please open phpgallery\phpgallery\resources\Layout\SlideShow\Code.js and copy/paste the following code:

    function GalleryLayout(gb)
    {
     this.Browser=gb;

     this.dng_photolist=this.Browser.FindElement("dng_photolist");
     
     
     
     this.Browser.Control.style.minHeight=this.Browser.Control.style.height;
     this.Browser.Control.style.height="";
     
     var uploadercontainer=this.Browser.GetUploaderContainer();
     if(uploadercontainer)
     {
      this.Browser.FindElement("dng_uploaderholder").appendChild(uploadercontainer);
     }
     else
     {

     }
     
     this._categories=this.Browser.GetCategories();

     this.DrawUI();
    }

    GalleryLayout.prototype.DrawUI=function _GalleryLayout_DrawUI()
    {
     clearTimeout(this._animationTimerid);
     
     this.dng_photolist.innerHTML="";
     
     var photos=[];
     for(var i=0;i<this._categories.length;i++)
     {
      photos=photos.concat(this._categories[i].Photos);
     }
     for(var i=0;i<photos.length;i++)
     {
      var div=this.CreatePhotoDiv(photos[i]);
      this.AttachItemEvent(div);
      this.dng_photolist.appendChild(div);
     }
     
    }

    GalleryLayout.prototype.CreatePhotoDiv=function _GalleryLayout_CreateItemDiv(photo)
    {
     var div=document.createElement("DIV");
     div.className="GalleryPhotoItem";
     div.dngphoto=photo;

     var imgwidth=64;
     var imgheight=48;

     var img=this.Browser.CreateThumbnail(photo.Thumbnail,imgwidth,imgheight);
     div.appendChild(img);
     img.style.cursor="hand";
     img.onclick=ToDelegate(this,function()
     {
      this.Browser.ShowViewer(div.dngphoto);
     });
     return div;
    }

    GalleryLayout.prototype.AttachItemEvent=function _GalleryLayout_AttachItemEvent(div)
    {
     function SetDivClass(div)
     {
      var clsname;
      if(div.dngselected)
       clsname=" GalleryItemSelected";
      else
       clsname="";
      div.className="GalleryPhotoItem "+clsname;
     }
     div.onmouseover=ToDelegate(this,function()
     {
      if(this._currentTooltip)
       this._currentTooltip.OnItemOver(div);
      else
       this.CreateNewTooltip(div);
     });
     div.onmouseout=ToDelegate(this,function()
     {
      if(this._currentTooltip)
       this._currentTooltip.OnItemOut(div);
     });
     div.ondblclick=ToDelegate(this,function()
     {
      this.Browser.ShowViewer(div.dngphoto);
     });
     div.oncontextmenu=ToDelegate(this,function(event)
     {
      event=event||window.event;
      this.Browser.ShowPhotoMenu(div.dngphoto,div,event,this);
      if(event.preventDefault)event.preventDefault();
      event.cancelBubble=true;
      return event.returnValue=false;
     });
    }

    GalleryLayout.prototype.CreateNewTooltip=function _GalleryLayout_CreateNewTooltip(item,delay)
    {
     var tt={};
     var closed=false;
     var photo=item.dngphoto;
     var div=document.createElement("DIV");
     
     var scale = Math.min(128/photo.Width, 128/photo.Height);
     var width=Math.floor(photo.Width * scale);
     var height=Math.floor(photo.Height * scale)
     var thumb=this.Browser.CreateThumbnail(photo.Thumbnail,width,height);
     
     div.style.width=width+"px";
     div.style.height=height+3+"px";
     
     div.appendChild(thumb);
     
     div.className="ZINDEXTOOLTIP";
     div.style.position="absolute";
     div.style.display="none";
     
     InsertToBody(div);
     
     var pos=CalcPosition(div,item);

     pos.top-=Math.floor((height-item.offsetHeight)/2);
     pos.left-=Math.floor((width-item.offsetWidth)/2);
     
     div.style.top=pos.top+"px";
     div.style.left=pos.left+"px";
     
     var itemisover=true;
     var divisover=false;
     var checkid;
     var outtime;
     
      
     setTimeout(ToDelegate(this,function(){
      if(closed)return;
      if(!itemisover)
      {
       tt.Close();
       return;
      }
      
      div.style.display="";
      
      checkid=setTimeout(ToDelegate(this,CheckState),100);
      
     }),delay||100);
     
     function CheckState()
     {
      checkid=setTimeout(ToDelegate(this,CheckState),10);
      if(itemisover||divisover)
      {
       outtime=null;
       return;
      }
      
      if(!outtime)
      {
       outtime=new Date().getTime();
       return;
      }
      
      if(new Date().getTime()-outtime>300)
      {
       tt.Close();
      }
     }

     
     div.onmouseover=function()
     {
      divisover=true;
     }
     div.onmouseout=function()
     {
      divisover=false;
     }
     div.style.cursor="hand";
     div.onclick=ToDelegate(this,function()
     {
      //this.ShowPhoto(photo);
      this.Browser.ShowViewer(photo);
      tt.Close();
     })
     div.oncontextmenu=ToDelegate(this,function(event)
     {
      event=event||window.event;
      this.Browser.ShowPhotoMenu(item.dngphoto,div,event,this);
      if(event.preventDefault)event.preventDefault();
      event.cancelBubble=true;
      return event.returnValue=false;
     });
     
     tt.Close=ToDelegate(this,function()
     {
      if(closed)return;
      closed=true;
      
      clearTimeout(checkid);
      
      document.body.removeChild(div);
      
      this._currentTooltip=null;
     })
     
     tt.OnItemOver=ToDelegate(this,function(anotheritem)
     {
      itemisover=true;
      if(anotheritem!=item)
      {
       tt.Close();
       this.CreateNewTooltip(anotheritem,10);
      }
     })
     tt.OnItemOut=ToDelegate(this,function(anotheritem)
     {
      itemisover=false;
     })
     
     
     this._currentTooltip=tt;
    }

    GalleryLayout.prototype.Ajax_Result=function _GalleryLayout_Ajax_Result(ret,param,method)
    {
     if(method=="GetAllCategoryData"||method=="GetCategoryData")
     {
      this._categories=this.Browser.GetCategories();
      this.DrawUI();
     }
    }

    Step 2. Copy the following code into a PHP page and test it.

    <?php require_once "phpgallery/include_phpgallery.php" ?>
    <?php

    //must declare the gallery and set properties here! for ajax request
    $gallery=new PhpGallery();

    $gallery->GalleryFolder="defaultalbum"; //the path to the image directory
    $gallery->AllowEdit=true;   //default is false
    $gallery->AllowPostComment=true; //default is false
    $gallery->AllowShowComment=true; //default is true;

    //set the user info for comment poster, if not set, the poster will save as guest
    $gallery->LogonUserID="username@server.com";
    $gallery->LogonUserName="UserName";

    //set the resource component option.
    $gallery->Layout="SlideShow";
    $gallery->Editor="Explorer";
    $gallery->Slider="NewWin";
    $gallery->Viewer="LightBox";
    $gallery->Popup="Default";
    $gallery->Theme="Classic";

    //handle the ajax request , if any
    $gallery->ProcessAjaxPostback();

    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     <title>SlideShow Layout - PHP Gallery</title>
     <link href="Sample.css" type="text/css" rel="stylesheet" />
    </head>
    <body>
    <a href="#" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a> |
    <table>
        <tr>
            <td style="padding-right:30px"><a href="http://localhost/phpgallery/test.php?Category=1">category1</a></td>
            <td style="padding-right:30px"><a href="category2http://localhost/phpgallery/test.php?Category=2">category2</a></td>
            <td style="padding-right:30px"><a href="http://localhost/phpgallery/test.php?Category=3">category3</a></td>
        </tr>
    </table>

     <?php
      $gallery->Render();
     ?>


    </body>
    </html>


    Keep me posted

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-23-2010, 2:59 PM 64170 in reply to 64169

    Re: Image Categories Help

  •  09-23-2010, 2:59 PM 64171 in reply to 64169

    Re: Image Categories Help

View as RSS news feed in XML