The method is as follows:
Open the postview. ascx file under the theme directory.
Go to <asp: placeholder id = "bodycontent" runat = "server"/>
Add a point beforeCode<% = Getimage (base. showexcerpt, post. Content) %>
The modification is as follows:
<Div class = "entry"> <% = getimage (base. showexcerpt, post. content) %> <asp: placeholder id = "bodycontent" runat = "server"/> </div>
Of course, do not forget to add the code of the getimage () function. Add the last section of the postview. ascx file:
<Script language = "CS" runat = "server">
String getimage (bool showexcerpt, string input)
{
If (! Showexcerpt | input = NULL)
Return "";
String pain = input; // string
String Pattern = @ " ";
System. Text. regularexpressions. Match m = system. Text. regularexpressions. RegEx. Match (input, pattern,
System. Text. regularexpressions. regexoptions. ignorecase | system. Text. regularexpressions. regexoptions. multiline );
If (M. Success)
{
String src = getsrc (M. value );
String IMG = string. format (" ", SRC );
Return IMG;
}
Else
{
Return "";
}
}
String getsrc (string input)
{
String Pattern = "src = [\ '| \"] (. + ?) [\ '| \ "]";
System. Text. regularexpressions. RegEx reimg = new system. Text. regularexpressions. RegEx (pattern,
System. Text. regularexpressions. regexoptions. ignorecase | system. Text. regularexpressions. regexoptions. multiline );
System. Text. regularexpressions. Match mimg = reimg. Match (input );
If (mimg. Success)
{
Return mimg. value;
}
Return "";
}
</SCRIPT>