mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-25 22:03:45 -06:00
RichText: EncodeHTML now using image style width / height instead of rescaling internally
git-svn-id: svn://ultimatepp.org/upp/trunk@15277 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
abc82450f3
commit
138820564b
1 changed files with 4 additions and 9 deletions
|
|
@ -341,28 +341,23 @@ String DefaultHtmlObjectSaver::GetHtml(const RichObject& object, const String& l
|
|||
String name;
|
||||
name << namebase << "_" << im++ << ".png";
|
||||
Size psz = object.GetPixelSize();
|
||||
String lname;
|
||||
lname << "L$" << name;
|
||||
Size sz = z * object.GetSize();
|
||||
if(abs(100 * (psz.cx - sz.cx) / sz.cx) < imtolerance)
|
||||
sz = psz;
|
||||
PNGEncoder png;
|
||||
png.SaveFile(AppendFileName(outdir, name), object.ToImage(sz));
|
||||
png.SaveFile(AppendFileName(outdir, name), object.ToImage(psz));
|
||||
String el = "</a>";
|
||||
if(IsNull(link)) {
|
||||
if(psz.cx * psz.cy != 0)
|
||||
html << "<a href=\"" << lname << "\">";
|
||||
html << "<a href=\"" << name << "\">";
|
||||
else
|
||||
el.Clear();
|
||||
}
|
||||
else
|
||||
html << "<a href=\"" << link << "\">";
|
||||
html << "<img src=\"" << name << "\" border=\"0\" alt=\"\">";
|
||||
html << Format("<img src=\"%s\" border=\"0\" alt=\"\" style=\"width: %d`px; height: %d`px\">",
|
||||
name, sz.cx, sz.cy);
|
||||
html << el;
|
||||
if(IsNull(link) && psz.cx * psz.cy != 0) {
|
||||
PNGEncoder png;
|
||||
png.SaveFile(AppendFileName(outdir, lname), object.ToImage(psz));
|
||||
}
|
||||
return String(html);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue