I need to replace embed and img which are submitted by users. as you know, some of users try to add video or image file links into textfield.
I found some of examples of regex function in order to replace img and embed tag's WIDTH and HEIGHT values but there is a big problem.
I need a function that can replace those dimensions with SCALE PROPOTIONS. its like croping an image that is uploaded. for example user wrote this code in textfield :
" width="1400" height="1000">
and I have specific maximum WIDTH and HEIGHT values :
max_width = 700
is it possible to replace that tag like (in order to max width-height values):
" width="700" height="500">