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

  • SEARCH
  • Home
  • 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 7009697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:53:42+00:00 2026-05-27T21:53:42+00:00

I have an asp.net mvc project, and a function that streams out an image

  • 0

I have an asp.net mvc project, and a function that streams out an image based on url parameters. like: /Image/40/100/50 streams out image with ImageID 40, 100px wide and 50px high.

So is there a way to change:

<img class="image" src="/Content/View?fileID=31" style="width: 500px; height: 100px; " />

To:

<img class="image" src="/Image/31/500/100" style="width: 500px; height: 100px; " /> 

In some fancy way?
/Lasse

  • 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-05-27T21:53:43+00:00Added an answer on May 27, 2026 at 9:53 pm

    I’m not sure I understand why you’re trying to do this, but something along the lines of the following should do the trick:

    $("img[src^='/Content/View?fileID=']").each(function() {
        var img = $(this);
        var id = img.attr("src").substring(21);
        img.attr("src", "/Image/" + id + "/" + img.width().toString() + "/" + img.height().toString());
    });
    

    Link to example: http://jsfiddle.net/Cfdfp/2/

    Also, if you’re only applying the image class to img elements that require this transformation, you could simplify the selector above:

    $(".image").each(function() {
        var img = $(this);
        var id = img.attr("src").substring(21);
        img.attr("src", "/Image/" + id + "/" + img.width().toString() + "/" + img.height().toString());
    });
    

    Link to example: http://jsfiddle.net/Cfdfp/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC project that I would like to unit test. Most
I have an ASP.NET MVC project with a form. In the Action method that
I have an ASP.NET MVC project and I have a single action that accepts
We have an ASP.Net MVC project that will start with a single web server
I have an Asp.net MVC project that modestly uses jQuery scripts. My views also
I have a new asp.net mvc project and i am trying to figure out
I have an ASP.NET MVC project that works fine on my local machine (no
I have a ASP.NET MVC project, and I would like to have a different
I have an Asp.Net MVC project with the typical forms authentication that redirects the
I have a ASP.net MVC project, which utilizes resource entries (.resx) through out the

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.