순지난의 좋은선물



CATEGORY

분류 전체보기 (62)
아이폰 (5)
안드로이드 (2)
PHP (7)
IT 팁 (13)
snoopy.class (8)
sencha (0)
PhoneGap (0)
jQuery (2)
리눅스 (4)
즐겨찾기 (2)
js (1)
Html &CSS (6)
wowza (1)
모바일웹 (1)
ajax (0)
mysql (1)
apps (5)
corona sdk (1)

RECENT ARTICLE

RECENT COMMENT

RECENT TRACKBACK

ARCHIVE

LINK




I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)

I have a weblog system that i am creating, the trouble is that if a
user links to an external image larger than 500pixels in width, it
messes with the whole layout.

I had found some regex code im using atm but its not good at matching
the entire image tag. It seems to ignore properties after the src
declaration and not match tags that have properties before the src
declaration .

preg_match_all("/\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)/i",
$data, $matches);
print_r($matches);

This currently makes two arrays for me, the source location from all
img tags and a large part of the tag itself. But not the entire tag.

What i do is i match the img tag, find the src, get the image
properties, and if the width is more than 500, i shrink it down and
add width="X" and height="Y" properties to the image tag.

How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.
.
And