Prevent auto population of title during upload

Last post 02-11-2011, 9:52 PM by Kenneth. 9 replies.
Sort Posts: Previous Next
  •  01-26-2011, 4:25 PM 65898

    Prevent auto population of title during upload

    When up loading photos, DotNetGallery populates the title with the file name. Anyway to prevent this? I don't want the file name to show in the gallery.
     
    Alternative: Is there a way to hide the title based on the gallery or the conents of the title field? In other words, gallery1 shows the title, but gallery2 does not. OR if a title consist of '.png' or '.jpg' then do not show the title.
    Filed under:
  •  01-26-2011, 10:59 PM 65901 in reply to 65898

    Re: Prevent auto population of title during upload

    Hi VanAwful,
     
    Can you send me some screenshots to show where/what you want to hide?
     
    Kenneth@CuteSoft.net
     
    Regards,
     
    ken
  •  01-30-2011, 5:16 PM 65952 in reply to 65901

    Re: Prevent auto population of title during upload

    Ken, when a photo is uploaded, DotNetGallery auto populates the Title field in the photos config file with the filename. I would like DotNetGallery to leave this field blank when uploading photos.
     
    Example of contents of config file for a newly uploaded photo:
    <photo id="DSCN0474" categoryid="" title="DSCN0474.JPG" comment="" width="1944" height="2592" filesize="995960" ipaddress
    I would like to see this instead:
    <photo id="DSCN0474" categoryid="" title="" comment="" width="1944" height="2592" filesize="995960" ipaddress
    Is this possible?
  •  01-30-2011, 9:22 PM 65955 in reply to 65952

    Re: Prevent auto population of title during upload

    Hi VanAwful,
     
    If you just want to hide the title please try the steps below
     
    The steps below shows you how to hide the title in classic layout
     
    1. Open file "\CuteSoft_Client\Gallery\Layout\Classic\Code.js"
     
    2. Find section below
     
    var titltText=photo.Title;
     
    3. Change to
     
    var titltText="";
     
    If you want to hide the title in other layout, you can fine the same section in the corresponding script file
     
    Regards,
     
    Ken
     
  •  01-31-2011, 1:49 PM 65969 in reply to 65955

    Re: Prevent auto population of title during upload

    Can I set that in my page? I have one aspx page that presents content for eight different galleries (folders). I want the photos in the first two to have titles. I would like to have the title blank or hide the title for the other six galleries.
     
    So, hide or show the title depending on which gallery I am currently viewing.
  •  02-01-2011, 9:07 PM 66003 in reply to 65969

    Re: Prevent auto population of title during upload

    Dear VanAwful,
     
    Please check http://cutesoft.net/ASP.NET+Image+Gallery/demo.aspx , which layout are you using?
     
    Thank you for asking
  •  02-06-2011, 1:48 PM 66081 in reply to 66003

    Re: Prevent auto population of title during upload

    Eric, I am using the classic layout.
  •  02-06-2011, 4:50 PM 66084 in reply to 66081

    Re: Prevent auto population of title during upload

    Dear VanAwful,
     
    Please follow steps:
    1. Open "\CuteSoft_Client\Gallery\Layout\Classic\Code.js"
    2. Add the following code at the bottom of this file:
        GalleryLayout.prototype.CreatePhotoDivNull=function _GalleryLayout_CreateItemDiv(photo)
    {
     var div=document.createElement("DIV");
     div.className="GalleryPhotoItem";
     div.dngphoto=photo;
     var t=document.createElement("TABLE");
     t.style.width="100%";
     t.style.height="100%";
     t.border=0;
     t.cellSpacing=0;
     t.cellPadding=0;
     var c1=t.insertRow(-1).insertCell(-1);
     var c2=t.insertRow(-1).insertCell(-1);
     c1.className="GalleryItemImageCell";
     c1.onselectstart=new Function("","return false");
     c2.style.textAlign="center";
     var scale = Math.min(128/photo.Width, 96/photo.Height);
     var img=this.Browser.CreateThumbnail(photo.Thumbnail,Math.floor(photo.Width * scale),Math.floor(photo.Height * scale));
     c1.appendChild(img);
     img.style.cursor="hand";
     img.onclick=ToDelegate(this,function()
     {
      this.Browser.ShowViewer(div.dngphoto);
     });
     
     c2.innerHTML="<span class='GalleryItemText'></span>";
     var titltText="";
     if(titltText&&titltText.length>30)titltText=titltText.substring(0,30)+"..";
     c2.firstChild.appendChild(document.createTextNode(titltText));
     
     if(this.Browser.Param.AllowShowComment)
     {
      var cs=photo.Comments;
      if(cs&&cs.length)
      {
       c2.innerHTML+="<br/><span class='GalleryItemNumComments'>"+cs.length+" "+GalleryLocalize.NUMCOMMENTS+"<span>";
      }
     }
     
     div.appendChild(t);
     return div;
    }
     
    3. Change the following code:
    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);
     } 
    }
     
    to:
    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 j=0;j<this._categories[i].Photos.length;j++)
         {
          //You can change this condition
          if(i<2)
          {
           var div=this.CreatePhotoDiv(this._categories[i].Photos[j]);
           this.AttachItemEvent(div);
           this.dng_photolist.appendChild(div);
          }
          else
          {
           var div=this.CreatePhotoDivNull(this._categories[i].Photos[j]);
           this.AttachItemEvent(div);
           this.dng_photolist.appendChild(div); 
          }
         }
     }
    }
     
    4. After done, please test it again.
     
    Thank you for asking
  •  02-07-2011, 1:32 PM 66101 in reply to 66084

    Re: Prevent auto population of title during upload

    Thank you Eric, but this appears to work based on categories. I do not have categories, so this will not work? Unless there is a value that I must in the album.config file?
     
    Example of what I have:
    Eight separate folders:
    ~/galleryfiles/2011/event1
    ~/galleryfiles/2011/event2
    ~/galleryfiles/2011/event3
    ~/galleryfiles/2011/event4
    ~/galleryfiles/2011/event5
    ~/galleryfiles/2011/event6
    ~/galleryfiles/2011/event7
    ~/galleryfiles/2011/event8
    Base on which gallery a guest wishes to see I set: GalleryBrowser1.GalleryFolder=selected_album
     
    I would like to handle it from the aspx page. Something like this:
    If (selected_album==event1){
       showTitle=false;
    }
    else showTitle=true;
     
     
     
  •  02-11-2011, 9:52 PM 66184 in reply to 66101

    Re: Prevent auto population of title during upload

    Hi VanAwful,
     
    Please try this way
     
    1. Open file D:\2005\Gallery\CuteSoft_Client\Gallery\Layout\Classic\Code.js
     
    2. Find section below
     
    var titltText=photo.Title;
     
    3. Change to
     
    var titltText=photo.Title;
        if(status=="false")
        {
          titltText  = "";
        }
     4. Text the example below
     
    1. <%@ Page Language="c#" AutoEventWireup="false" %>  
    2.   
    3. <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>  
    4.   
    5. <script runat="server">  
    6.     public string Status = "true";  
    7.   
    8.     protected void btnChangeStatus_Click(object sender, EventArgs e)  
    9.     {  
    10.         Status = "false";  
    11.     }  
    12. </script>  
    13.   
    14. <script>  
    15.  var status="<%= Status %>";  
    16. </script>  
    17.   
    18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    19. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
    20. <head>  
    21.     <title>Classic Layout - DotNetGallery</title>  
    22.     <link href="Sample.css" type="text/css" rel="stylesheet" />  
    23. </head>  
    24. <body>  
    25.     <form id="form1" runat="server">  
    26.         <asp:Button ID="btnChangeStatus" runat="server" Text="Change Status" OnClick="btnChangeStatus_Click" />  
    27.         <DotNetGallery:GalleryBrowser runat="server" ID="GalleryBrowser1" Width="780" Height="400" />  
    28.     </form>  
    29. </body>  
    30. </html> 
     
     5. Now you can hide or show the title by string "Status" at codebehind. So you can change the this value according to gallery folder name too.
     
    Regards,
     
    Ken
View as RSS news feed in XML