i'm having a problem with finding an replacing certain values in strings passed to a message board. basically, i have things set up so users can post videos or images, but i want to limit the dimensions to, say, 400px in width so i don't have everthing shifting around on the page. i can easily do this with the following string replacement method:
what i would like to do, though, is find the original width value and determine if it is over my max value, and if so replace it with the max value. that way smaller images are not scaled up. also i think it would be useful for finding the value of the height and scaling it in proportion to width of the file instead of supplying an arbitary height value and risk stretching the image.
thanks for the responses, but i got there in the end. my solution was to look for the start of the width code in whatever the user had posted, in this case "width=\"". from there i exploded the code into two parts, left and right, and exploded the right part of the code again to leave the value of the width.