### the record
10|My Title|This is my text content<br><br>Another paragraph with lotsa words<br><br>Even more text and images may follow.<br><img src="/images/one.jpg"><br><img src="/images/two.jpg"><br><br>etc-etc-etc.
### So I have the content into an array, fine no probem.
@content= split (/\s+/, $bc);
$mytext = join(" ", @content[0..12]); # gets first 12 words of content text (works great)
### how do I get one.jpg, and have it in front of the $mytext?
### and if no images present in record, the just show the text.
### (CSS will handle sizing just for this show of the image, so will need room to do that).
print qq ~$mytext~;
Can find nothing about this anywhere. Want to avoid using a module on this, if possible.
Would it be a good idea to assign an id to the first image when I do the entry? That way I could look for the image with the id and ignore all the rest. Just thinking as I'm typing.
01-19-2013, 05:00 AM
my ($before_img1, $img1, $after_img1) = $bc =~ /(.*?)(<\s*img\b[^>]*>)(.*)/;
01-19-2013, 01:42 PM
That works. I managed to resize the image (by changing style class) and it works in the browsers I've got - IE, Chrome (Safari), Ffx.