Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
12 views

I use telerik web ui  2024.1.131.45 in my asp net web app. Using Rad Image Gallery the thumbnail is not showing (see attached). Any idea why?

Thanks before

 

Rumen
Telerik team
 answered on 02 Apr 2025
1 answer
33 views

Hi everyone,

Hi everyone, I'm using Telerik UI, and when I'm on a mobile view with the content editor, and then I select the image gallery, it doesn't seem to be responsive, or its just too wide for the phone screen.  Is there some way to force that image manager to be the correct size? Or is that even possible?  

 

Rumen
Telerik team
 answered on 17 Jan 2025
1 answer
154 views

We have the RadImageGallery implemented on page. The code behind loads up one or more images by reading in an array of bytes from each file.  Occasionally, an exception is thrown when one of those images is invalid (corrupt or some other issue).  OK, that's fine, but we would like to trap the exception and handle the error in a particular way.  But... we don't seem to be able to trap it other than in our last-chance global exception handler.

The binary data is created in the NeedDataSource event, and that returns successfully.  I've added other events and set breakpoints in each of them, and they all return ok.  So, is there an event we can handle that would be appropriate for a simple try/catch block?

Pretty simple markup for the RadImageGallery control (note, all the events after the OnNeedDataSource were added simply to test out if there was a place we could try/catch the exception, but no exception was thrown in those events):

    <telerik:RadImageGallery ID="galleryImages" runat="server" RenderMode="Lightweight"
        DisplayAreaMode="Image" LoopItems="true" DataImageField="ImageBytes" DataDescriptionField="Description" DataTitleField="Title"
        OnNeedDataSource="galleryImages_NeedDataSource"
        OnDataBinding="galleryImages_DataBinding"
        OnImageRequested="galleryImages_ImageRequested" 
        OnItemCreated="galleryImages_ItemCreated" 
        OnPreRender="galleryImages_PreRender">
    </telerik:RadImageGallery>

 

Code behind for NeedDataSource (which returns successfully):

    protected void galleryImages_NeedDataSource(object sender, Telerik.Web.UI.ImageGalleryNeedDataSourceEventArgs e)
    {
        galleryImages.Visible = false;

        FileManager fileManager = new FileManager ();
        DataTable dt = fileManager.GetFileList();
        var imageFiles = fileManager.GetGalleryImages(dt);

        if (imageFiles.Count() == 0)
        {
            txtNotes.Text = "There are no image files to display.";
            return;
        }

        try
        {
            galleryImages.DataSource = imageFiles;
            galleryImages.Visible = true;
        }
        catch (Exception ex)
        {
            LogException(ex);
            ErrorMessage("An unexpected occurred while reading one or more the image files");
        }

        if (fileManager.HasErrors)
        {
            txtErrors.Text = "The following errors were encountered:<br/><ul>" + String.Join("<li>", fileManager.ErrorList) + "</ul>";
        }
    }

 

Library code that reads image files into byte arrays (also return successfully):

        public List<GalleryImage> GetGalleryImages(DataTable srcDataTable)
        {

            //...


            foreach (DataRow dr in query)
            {
                CustomImageFile f = new CustomImageFile(dr);                

                try
                {
                    byte[] byteArray = File.ReadAllBytes(f.FullFileName);
                    GalleryImage img = new GalleryImage
                    {
                        ImageBytes = byteArray,
                        Description = $"{f.Description}", // [{f.Name}]
                    };
                    imageList.Add(img);
                }
                catch (Exception ex)
                {
                    Errors.Add($"{f.Name} could not be read");
                    LogException(ex);                    
                }
            }
            return imageList;
        }

 

Yet when there is an invalid file encountered, we get this:

[ArgumentException: Parameter is not valid.]
   System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) +1162080
   Telerik.Web.UI.BinaryImageFormatHelper.CreateImgFromBytes(Byte[] data) +69

[ArgumentException: The provided binary data may not be valid image or may contains unknown header]
   Telerik.Web.UI.BinaryImageFormatHelper.CreateImgFromBytes(Byte[] data) +120
   Telerik.Web.UI.BinaryImageTransformationFilter.ProcessImageInternal(Byte[] image) +44
   Telerik.Web.UI.BinaryImageTransformationFilter.ProcessImage(Byte[] image) +20
   Telerik.Web.UI.BinaryImageFilterProcessor.ProcessFilters(Byte[] imageData) +112
   Telerik.Web.UI.RadBinaryImage.ProcessImageData() +57
   Telerik.Web.UI.RadBinaryImage.OnPreRender(EventArgs e) +20
   System.Web.UI.Control.PreRenderRecursiveInternal() +90
   System.Web.UI.Control.PreRenderRecursiveInternal() +163

 

Attila Antal
Telerik team
 answered on 07 Jun 2024
1 answer
516 views
Hi,
the scenario we need is this:
There is a list of images displayed in the gallery view (images are stored on the http file server). After you click on one of the images in the gallery view, we need the image editor to load the selected image for editing, and be able to save it after editing is done.

Do we need to download image first to the local temp folder, or can we load them from the URL? Is there an example?

How can I get image from the selected gallery item loaded into the editor?

Thank you,

Doncho
Telerik team
 answered on 27 May 2022
1 answer
94 views
I would like to show the alt tag / tooltip of the image title when the cursor is hovered over the thumbnail. Any way that can be done?
Rumen
Telerik team
 answered on 18 Feb 2022
5 answers
157 views
I do not want Description box to go away without appearing all the time. How do I do that.
Now I must go with the mouse pointer for it to resurface, or I can put time how long it stays?
Vessy
Telerik team
 answered on 09 Mar 2021
1 answer
99 views

actually there is a method get_itemIndex(), which would be equivalent to a method set_selectedIndex(index) from RadMultipage or one method like select()
from RadComboBox

How could I implement it or a code javascript would help me a lot

thanks

Peter Milchev
Telerik team
 answered on 27 Nov 2020
1 answer
101 views

Can someone help - I can't find anything in the docs, but it shoud be easy...

I have an image gallery working with sqldatasource and all looks good except the readability of the title text which appears over the image.

The customers for this website are 'senior citizens'  and can't read the captions. (see bessacarr-owners-club.org/photo-gallery.aspx)

My problem is that the text is a shade of grey and the surrounding box is also a (lighter) shade of grey. How can I make the text more contrasting.

eg the background darker and the text lighter?

Thanks

Clive

 

Q2 2016 controls in use

Vessy
Telerik team
 answered on 31 Aug 2020
8 answers
561 views
I am using the IMage gallery successfully except for a few images which are higher than they are wide, and when rendered in the control, it rotates them sideways. I want to prevent this without modifying the image. How can I get the control to display the image
Peter Milchev
Telerik team
 answered on 07 Apr 2020
2 answers
168 views

I am converting an old application that stores its images as base64strings in a SQL Server database.

I am trying to add the images to the gallery. Pointing the ImageURL to a base64 string works fine, but not the ThumbnailURL.

        public static string ImageToBase64(System.Drawing.Image image, System.Drawing.Imaging.ImageFormat format)

        {
            string returnString = "";
            System.IO.MemoryStream ms = new MemoryStream();

            image.Save(ms, format);
            byte[] imageBytes = ms.ToArray();
            returnString = "data:image;base64," + Convert.ToBase64String(imageBytes);

            return returnString;
        }

        public static Telerik.Web.UI.ImageGalleryItem ImageBase64(byte[] BlobData, string ImageTitle)
        {
            Telerik.Web.UI.ImageGalleryItem returnImage = new Telerik.Web.UI.ImageGalleryItem();

            System.Drawing.Image img = null;
            System.IO.MemoryStream mem = new MemoryStream();
            mem.Write(BlobData, 0, BlobData.Length);
            mem.Seek(0, SeekOrigin.Begin);

            img = System.Drawing.Image.FromStream(mem);

            returnImage.Title = ImageTitle;
            returnImage.ThumbnailUrl = ImageToBase64(SizedImage(img, 100, 75), System.Drawing.Imaging.ImageFormat.Jpeg);
            returnImage.ImageUrl =     ImageToBase64(SizedImage(img, 800, 600), System.Drawing.Imaging.ImageFormat.Jpeg);
            return returnImage;
        }

        returnImage.ImageUrl works perfectly fine.

 


        public static System.Drawing.Bitmap SizedImage(System.Drawing.Image img, int dispWidth, int dispHeight)
        {
            double scale = 1.0, hScale = 1.0;
            double imgWidth = img.Width;
            double imgHeight = img.Height;

            if (imgWidth > dispWidth)
                scale = dispWidth / imgWidth;
            if (imgHeight > dispHeight)
                hScale = dispHeight / imgHeight;
            if (hScale < scale)
                scale = hScale;

            int imgw = Convert.ToInt32(imgWidth * scale);
            int imgh = Convert.ToInt32(imgHeight * scale);

            return new System.Drawing.Bitmap(img, imgw, imgh);
        }

Richard
Top achievements
Rank 1
 answered on 23 Sep 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?