Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8707033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:45:53+00:00 2026-06-13T03:45:53+00:00

I am trying to get thumbnail for the original image, for requested widths and

  • 0

I am trying to get thumbnail for the original image, for requested widths and heights with the help of generic handler. But I want to authorize requests to some limited set of widths and heights.
ex. 18*18, 98*94, 117*113 etc.
Anything out of these predefined sets would be treated as bad request.
So I want to save these predefined set of height and width in some kind of data structure. So that when I get request for some width and height, I can check if this belongs to predefined set. If not, I can ignore the request.. Something like:

     if(PreferredWidths.Contains(requestedWidth).Index == PreferredHeights.Contains(requestedHeight).Index)
{
           // Process request.. 
}

This was some logic, I could come up, which I want to convert in a code( Anything better is appreciated). I am not sure which data structures I should use for storing set of widths and heights. Is there any better approach, that I can use for same purpose. As any fake user can change the source of image from browser by just changing parameters of handler url (abc.ashx?Id=123&width=20&height=30). Internally, I am creating thumbnails, saving them on disk and returning urls of the same. I dont want to do this stuff, if set of requested width and height is not legal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:45:54+00:00Added an answer on June 13, 2026 at 3:45 am

    There is a Size struct in System.Drawing. You could just store a list of Sizes and then use:

    var ValidSizes = new List<Size> 
    {
        new Size(18, 18),
        new Size(98, 94),
        new Size(117, 113)
    };
    
    if(ValidSizes.Any(p => p.Width == requestedWidth && p.Height == requestedHeight))
    {
        // Process Request
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get my Wordpress theme to pull up a thumbnail image for
I have been trying for several hours now to get sorl-thumbnail working, but it
I'm trying to get Sorl-thumbnail running on my staging server, but I'm running into
I'm trying to get the main image to change depending on the thumbnail image
I am trying to get a user's thumbnail from another intranet site but some
I'm trying to get video thumbnails from Vimeo, but for some reason, I cannot
Trying to get the width and height of the uploaded image while still in
I'm trying to create a thumbnail image on the client side using javascript and
I am trying to get a view with multiple pictures as thumbnails; but i
I'm trying to create thumbnail and resize image at the same time, so to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.