> So, I have this in my gd.png file:
>
> [% META nowrap=1 %]
> [%-
> USE gdc = GD.Constants;
> USE im = GD.Image(200,100);
> black = im.colorAllocate(0 ,0, 0);
> red = im.colorAllocate(255,0, 0);
> r = im.string(gdc.gdLargeFont, 10, 10, "Large Red Text", red);
> im.png;
> -%]
>
> And this in the "process" file:
>
> [%-
> IF template.nowrap;
> PROCESS $template | trim;
> RETURN;
> END;
>
> WRAPPER page.tt2; PROCESS $template; END
> -%]
>
> Now, this works with tpage, but for some reason, ttree winds up creating
> a corrupt image file. I checked, and ttree is not wrapping the file,
> but the contents are NG. Ideas?
Here are some things to check:
- did you remove the output gd.png file and do a fresh run of ttree?
- use od to compare the binary output files generated by tpage and ttree.
Are they different sizes? Where are they different?
- You probably shouldn't run the gd file through trim:
> PROCESS $template | trim;
since it could contain leading or trailing whitespace (although
png files don't start with whitespace; I'm not sure about the last
bytes. Your sample png file doesn't start or end with whitespace,
so the trim is a no-op).
Craig