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 7015515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:39:44+00:00 2026-05-27T22:39:44+00:00

I have a server size image stream where you pass fileid, width and height

  • 0

I have a server size image stream where you pass “fileid”, width and height to and it streams an image to client. I’m using CKEditor, and would like to add jquery function that changes it’s url when height or width changes in the textboxes.

As you see here on the pic its a specific format:

enter image description here

/Content/Image/{digit}/{width}/{height} rest is optional in string.

Lets say id’s of them textboxes are “txtwidth” and “txtheight”, how would you add jquery functionality to it that replaces width and height in url textbox, and only if it matches string starting with /Content/Image/{digit}/{width}/{height}?

Thanks in advance

/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-27T22:39:44+00:00Added an answer on May 27, 2026 at 10:39 pm

    You can do this easily by using regexp to match the string and to replace the corresponding parts. As you mentioned that you’d want to do this with jQuery I am assuming you have jQuery already on your site, but if you don’t I wouldn’t recommend adding it for this.

    Instead of explaining further what to do, I’ve pasted the code below and commented each step, which should make it quite clear what’s going on:

    // bind onchange and keypress events to the width and height text boxes
    $('#txtwidth, #txtheight').bind('change keypress', function(){
    
        // define the regexp to which to test with, edit as needed
        var re = /\/Content\/Image\/([0-9]+)\/[0-9]+\/[0-9]+\//,
            // store url and its value to a variable so we won't have to retrieve it multiple times
            url = $('#url'),
            val = url.val();
    
        // test if regexp matches the url
        if (!re.test(val)) {
            // doesn't match
             return;    
        }
    
        // we got this far, so it did match
    
        // replace the variables in the regexo
        val = val.replace(re, "/Content/Image/$1/" + $("#txtwidth").val() + "/" + $("#txtheight").val() + "/");
    
        // put it back into the input field
        url.val(val);
    
    });
    

    example: http://jsfiddle.net/niklasvh/wsAcq/

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

Sidebar

Related Questions

I have a requirement to upload image on server in 2 size, normal and
I have a table on SQL Server 2005 that was about 4gb in size.
I have a client-server Silverlight application, which is use Socets. I have server appliaction
My requirement is I have server J2EE web application and client J2EE web application.
I have a server access log, with timestamps of each http request, I'd like
I have a image file stored at a remote server (i.e http://example.com/images).The images in
I have a script which uploads an image to the server under the id
I have the following barcode image: I'm using the following iTextSharp VB.NET script to
i have an image where i am resizing the image into thumbnail size it
I have a server in linux using the Berkeley_sockets and I create a TCP

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.