How do I get the first image in a record?
For instance:
Can find nothing about this anywhere. Want to avoid using a module on this, if possible.Code:### 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[2]); $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~;
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.


Reply With Quote
Bookmarks