Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2004-08-16 01:17:56

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_image_replace, version 2

I have a solution for left alignment. Expect a new release soon.


Alex

Offline

#32 2004-08-16 22:25:33

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

The left alignment issue is because you do the -5000px to the left margin. If the attribute states for instance position="top left" the -5000px should be at the right margin and the text-align style should be set to right.

But I am guessing this is what you are working on for the new release.

Also, I have another issue. The typeface I use gets clipped at the bottom see my TXP development site for a “demo”.

Check the g in editing in the second article.

I tried setting the height attribute but then I realized that’s just for the CSS, not the image itself.

Also I might add that it’s a .pfm/.pfb font! So it works! Gotta celebrate this somehow hehehe .. The font attribute point to the .pfb file and I am not sure if the .pfm file is needed, ohwell ..

Last edited by obeewan (2004-08-16 22:30:31)


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#33 2004-08-16 22:55:08

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Obeewan,

Regarding the ‘g’ issue: it could be that I’ve messed up the font baseline calculation, or it could be that Freetype reports it incorrectly or differently for .pfm fonts.

It’d help if you could collect some information for me. Edit the plugin (click on its name in the plugin list), and look for this line, about half way down:

<code>list($w, $h, $base_x, $base_y) = imagerotatedbbox($box, $angle);<code>

Add this just before that line:

<code>
print “<!—”;
var_dump($text, $box);
print “—>\n”;
</code>

Finally, temporarily add the attribute “cache=0” to your <txp:zem_image_replace> tag. Refresh the page, view the source, and you should see something like this:

<code>
<!—string(32) “A little editing of Textpattern”
array(8) { [0]=> int(-1) [1]=> int(1) [2]=> int(227) [3]=> int(1) [4]=> int(227) [5]=> int(-26) [6]=> int(-1) [7]=> int(-26)
}
—>

Post the results here, or send it to me via email.

Thanks.


Alex

Offline

#34 2004-08-16 23:09:38

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

It’s in your mailbox zem.

Also, the -5000px on the right alignment didn’t work properly as can see on my site. Creates a gigantic horisontal scrollbar since they think the element is thoose 5000px wide. Doh!

I was thinking to redo and make it -5000px top and vertical-align to top and the image to bottom left .. I’ll report my progress here.

—-

Edit:
Progressreport came fast. That idea I can scratch and flush down the toilet. Big fat no go there. Ohwell, I tried ;)

Last edited by obeewan (2004-08-16 23:12:55)


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#35 2004-08-16 23:52:38

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Which browser are you using? There’s no scrollbar in IE 6 or Mozilla.

I mistakenly left out one of the Radu attributes in the last version; perhaps the next release will fix it.


Alex

Offline

#36 2004-08-17 02:35:34

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Just came to think of something. To use clip on the headlines so it clips what to display, anything else gets cut off.

Currently I am too tired to write an example but with the above URL I think you (read zem) will get the hang of it.


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#37 2004-08-17 04:54:32

Case
Member
From: UK
Registered: 2004-02-25
Posts: 20
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Zem,

On this page you have used a width attribute to get your image titles to make them all align to the left correctly like so:

<h2 style="margin: 0 0 0 -5000px; background: url('/images/zir/77f3711e4b5a5622a2894629f0e87c4b.png') no-repeat top right; height: 32px; width: 5418px; text-align: left;">txp:zem_image_replace version 0.3.</h2>

The width is the 5000px negative margin plus the width of the actual dynamically created image. How do you calculate the width of the image to add to the 5000px and output that?

Also I’m using Freetype and find the images are clipped height wise when using .otf fonts. Do you have a fix for this too?

Last edited by Case (2004-08-17 04:55:08)


Forget your dreams

Offline

#38 2004-08-17 14:58:06

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Another bug:
It does not support swedish characters (ex åäöÅÄÖ) aswell as some portugeese (ex ñ). This bug may come from that the FreeType lib does not support UTF-8, not totally sure.

Swedish example
Portugeese example


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#39 2004-08-18 08:49:37

starzabove
Member
Registered: 2004-04-13
Posts: 76

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Anyone have any idea why it might be seriously chopping the images? Not just clipping corners, but most of the letters?
It’s happening on a couple of sites, and I’ve checked the CSS, and tried several other fonts, fonts that I am already using in other places, but I’m lost on this one.
Here is an example:
http://sternski.com
The top center title there should say “The Sterns”

The image that is made:
http://sternski.com/images/zir/ed133787b059d0dc5255ded7da43e1b5.png

Thanks!

Code on main index template page:
<code>
<div id=“head”>
<txp:zem_image_replace font=“XO.TTF” backgroundcolor=”#9a99ff” position=“center” class=“imrep” wraptag=“h3”>
The Sterns
</txp:zem_image_replace>

</div>
</code>

Corresponding CSS:
<code>
#head{margin:0;padding:0;}
.imrep{ color: #9a99ff; font-size:0px; text-decoration:none; height:100px;}
</code>

Last edited by starzabove (2004-08-18 08:55:31)


90+ Textpattern installs and still going…

Offline

#40 2004-08-18 11:58:46

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Last release gets the baseline wrong for some fonts. Working on it.


Alex

Offline

#41 2004-08-18 12:59:07

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

I tried and tried but did not get the clip CSS attribute to work, currently using FIR to get the text left-aligned as I want it to. Not optional for screenreaders but for now it will do.

I though have a new idea that might work. What if you add whitespace to the image according to how much alignment it uses. Say we use, -1000px on the left margin and want the background to “top left” align. Could we not just add 1000px to the left side of the created image? Since it would only be backgroundcolored (or even better, transparent) it would not take up that many bytes no?
Maybe not the best solution but might work.


Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1

“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu

Offline

#42 2004-08-19 09:01:19

starzabove
Member
Registered: 2004-04-13
Posts: 76

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Actually………… I figured out that it must be something else, zem, when I had tried fonts that were working fine on other sites with this same version.

Look at what works:
<code>
<div id=“head”>
<txp:zem_image_replace font=“XO.TTF” wraptag=“h3” backgroundcolor=”#9a99ff” fontsize=“36” class=“imrep” position=“center” angle=“4”>THE STERNS</txp:zem_image_replace>
</div>
</code>

compared to what didn’t:
<code>
<div id=“head”>
<txp:zem_image_replace font=“XO.TTF” backgroundcolor=”#9a99ff” position=“center” class=“imrep” wraptag=“h3”>
The Sterns
</txp:zem_image_replace>
</div>
</code>

And I added/removed the fontsize and angle to each, so that had no bearing – whether they were there or not.
So apparantly order matters for the attributes? I may have missed that, but thought I’d share with others just in case they did, or this was news.

Thanks again!

Last edited by starzabove (2004-08-19 09:02:54)


90+ Textpattern installs and still going…

Offline

#43 2004-08-19 09:41:53

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

With the default CSS algorythm positionning works fine with me. I’ve tested IE5.5, 6 and Mozilla. IE 5.01 is a little wrong, but that was predictable it can’t handle much CSS.

But, I can’t made the transparency to work. I’ve used <code><txp:zem_image_replace font=“merlinn.ttf” wraptag=“h1” color=”#FF7417” trans=“1” ></code> and the background is still white.

Example here : http://www.ludys.org/textpattern_g119/

Offline

#44 2004-08-19 09:54:16

Case
Member
From: UK
Registered: 2004-02-25
Posts: 20
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Jeremie,

You have to edit the plugin to get transparency to work. For some reason this has been commented out. Just remove the hash signs and it should work with trans=“1”

like so:

// set transparency if($transparent_background) ImageColorTransparent($image,$background_color) ;


Forget your dreams

Offline

#45 2004-08-19 10:01:52

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: [plugin] [ORPHAN] zem_image_replace, version 2

Thanks. It took my server a dozen attemp to handle it (don’t know why yet), but it made it.

Ouch… 8 bits transparency is really really ugly… I definitely need to find that MSIE hack to handle PNG’s alpha transparency.

Last edited by Jeremie (2004-08-19 10:02:50)

Offline

Board footer

Powered by FluxBB