Thumbnail in image gallery dialogue broken

Last post 09-11-2006, 11:06 AM by cutechat. 3 replies.
Sort Posts: Previous Next
  •  09-08-2006, 4:39 AM 22519

    Thumbnail in image gallery dialogue broken

    Hello

    The thumbnails in image gallery dialogue are broken; please can you tell me how I fix this. I have come across this issue in the forum a few times but it seems no one has posted a solution; I have also noticed that this issue affects some builds from time to time.

    Please can you let me know how I fix it, what caused the problem and also how the thumbnail generation works?

    Regards


    Reign Industries Ltd
    www.reignindustries.com
  •  09-08-2006, 11:14 AM 22535 in reply to 22519

    Re: Thumbnail in image gallery dialogue broken

    mregan,
     
    Please save the following file into an aspx and run it on your server.
     
    You need to find a Gif file, rename it to test.gif to test this script.
     
    <%@ Page language="c#" %>
    <%@ Import Namespace="System.IO" %>
    <%@ Import Namespace="System.Drawing" %>
    <%@ Import Namespace="System.Drawing.Imaging" %>
    <script runat=server>
    override protected void OnInit(EventArgs args)
    {
     string file=Server.MapPath("test.gif");
     
     byte[] data;
     using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read))
     {
      data = new byte[fs.Length];
      fs.Read(data, 0, data.Length);
     }

     

     Bitmap bm;
     int _width = 100, _height = 100;
     float fx, fy, f;
     int widthTh, heightTh;
     float widthOrig, heightOrig;

     using (Bitmap bitmapNew = new Bitmap(new System.IO.MemoryStream(data)))
     {
      widthOrig = bitmapNew.Width;
      heightOrig = bitmapNew.Height;

      fx = widthOrig / _width;
      fy = heightOrig / _height; // subsample factors

      // must fit in thumbnail size
      f = Math.Max(fx, fy);
      if (f < 1)
      {
       //clone
       bm=new Bitmap(bitmapNew);
      }
      else
      {
       widthTh = (int)(widthOrig / f);
       heightTh = (int)(heightOrig / f);
       bm=(Bitmap)bitmapNew.GetThumbnailImage(widthTh, heightTh, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
      }
     }

     Context.Response.ContentType = "image/Jpeg";
     bm.Save (Context.Response.OutputStream, ImageFormat.Jpeg);
    }
      public bool ThumbnailCallback()
      {
       return false;

      }
    </script>
     
     

     
     

    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-09-2006, 4:01 AM 22559 in reply to 22535

    Re: Thumbnail in image gallery dialogue broken

    Hi
     
    Did as you asked, i can see the thumbnail but the Image Gallery is still not working, what was this script meant to do?
     
    Regards

    Reign Industries Ltd
    www.reignindustries.com
  •  09-11-2006, 11:06 AM 22589 in reply to 22559

    Re: Thumbnail in image gallery dialogue broken

     
    That code just check whether your server has some settings that can't generate images.
     
    Now I think there's should be another problem that broke the images .
     
    Can you send me an URL for checking it ?
     
    If you don't want send URL to the forum , you can send it to my mail box terry @ cutesoft.net
     
    Regards , Terry .
View as RSS news feed in XML