WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 08.01.2016 16:03:45

webbird
Administrator

Help us fill the new Droplets download page!

English version below.

Das Droplets Modul in WBCE basiert auf dem erweiterten, aber "inoffiziellen" Modul mit der Version 1.7x. Dieses erlaubt unter anderem den Export und Import ausgewählter Droplets, das Verwalten dieser Backups sowie das Wiederherstellen von gelöschten Droplets. (Die Original-Version aus WB Classic erlaubt lediglich das Erstellen einer Vollsicherung aller Droplets.)

Als Seiteneffekt ist es sehr leicht möglich, selbst erstellte Droplets mit anderen zu teilen, indem man sie einfach exportiert und die ZIP-Datei dann zur Verfügung stellt. Eine entsprechende Seite gibt es bei AMASP, diese ist im Droplets-Modul auch verlinkt.

Wir bauen nun unsere eigene Seite auf, zumal AMASP nicht mehr gepflegt und aktualisiert wird, und würden uns freuen, wenn wir aktuelle Droplets gemeldet bekämen.


The Droplets module that is included with WBCE ist based upon the extended but "inofficial" version 1.7x which allows for export and import certain droplets, manage your backups and recover deleted droplets. (The original version included with WB classic only allows for a full backup of all droplets.)

As a side effect, it is now quite easy to share your droplets, by exporting them and provide the ZIP for download. A download page resides on AMASP, which is also linked from the Droplets module.

We are now working on our own page, as AMASP is no longer maintained and not up-to-date, and would would be pleased if you would support our work by reporting current droplets.


http://addons.wbce.org/pages/droplets.php


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

#2 08.02.2016 18:09:42

quinto
Mitglied

Re: Help us fill the new Droplets download page!

here is my own droplet:
Name : Text2png
Description : with this droplet you can create a ptruecolor png with antialiased text on a transparent background

[== PHP ==]
$cache_dir = WB_PATH.'/temp/';
$fontfile = WB_PATH.'/media/fonts/'.$ttffile;
$fontangle = 0;
if (!isset($fontsize)) $fontsize = "12";
if (!isset($fontcolor)) $fontcolor = "000000";
$comptext = html_entity_decode($text);
$cache_file = 'text2png_'.md5($text.$fontfile.$fontsize.$fontcolor).'.png';

if (!file_exists($cache_dir.$cache_file))
{$box = @imagettfbbox($fontsize, $fontangle, $fontfile, $text);
$textwidth = abs($box[4] - $box[0]);
$textheight = abs($box[5] - $box[1]);
$autopadding = 2*(abs($fontsize/10));
$imagewidth = $textwidth+$autopadding;
$imageheight = $textheight+$autopadding;
$xcord = ($autopadding/2);
$ycord = $imageheight-($autopadding);

$img = imagecreatetruecolor($imagewidth, $imageheight);
imagealphablending($img, false);
imagesavealpha($img, true);
imageantialias($img, true);
$opaque = imagecolorallocatealpha($img, 0, 0, 0, 0);
$transparent = imagecolorallocatealpha($img, 0, 0, 0, 127);

imagefilledrectangle($img, 0,0, $imagewidth, $imageheight, $transparent);

if( eregi( "([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})", $fontcolor, $textrgb ) )
{$textred = hexdec( $textrgb[1] );  $textgreen = hexdec( $textrgb[2] );  $textblue = hexdec( $textrgb[3] );}
$opaque = imagecolorallocate($img, $textred, $textgreen, $textblue);

imagettftext($img, $fontsize, $fontangle, $xcord, $ycord, $opaque , $fontfile, $comptext);

// invert alpha channel
for($i=0;$i<$xsize;$i++)
{for($j=0;$j<$ysize;$j++)
{$color = imagecolorat($img, $i, $j);
$color = ($color & 0x00FFFFFF) | ((127-($color>>24))<<24);
imagesetpixel($img, $i, $j, $color);
}
}
imagepng($img, $cache_dir.$cache_file);
imagedestroy($img);
}
return '<img src="'.WB_URL.'/temp/'.$cache_file.'" style="border:0px;margin:0px;padding:0px;vertical-align:top;" alt="'.$text.'"/>';

comment:
Use: [[Text2png?text=(text, Mandatory)&ttffile=(fontfile.ttf, Mandatory)&fontcolor=(fontcolor, Optional)&fontsize=(fontsize, Optional)]]

text = Text to convert into truecolor png with transparent background.
ttffile = True Type Font file (.ttf or .otf), must be in the folder media/fonts/ but you can change this in the code.
fontcolor = Color in 6 digit HEX format, "000000"(black) by default.
fontsize = Size of the font in points (if gd2 is used, otherwise in pixels), 12 by default.

This droplet has a rudimentary but efficient caching system but it never delete any file, if you want you can delete all the png files starting with the name "text2png_" in your temp folder, droplet will recreate the needed files.

Beitrag geändert von quinto (08.02.2016 18:13:46)

Offline

#3 08.02.2016 21:18:11

marmot
Mitglied

Re: Help us fill the new Droplets download page!

quinto schrieb:

here is my own droplet:
Name : Text2png

Nice idea but eregi is a bit out of date.

Offline

#4 09.02.2016 09:21:57

florian
Administrator

Re: Help us fill the new Droplets download page!

So what should be used instead?


Code allein macht nicht glücklich. Jetzt spenden!

Offline

#5 09.02.2016 12:51:42

webbird
Administrator

Re: Help us fill the new Droplets download page!

@quinto: Thank you very much for your nice droplet. Can you replace eregi() with preg_replace()? (eregi() is marked deprecated, I think it will not work with PHP 7.) If not, I can do it for you if you like.


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

#6 09.02.2016 13:52:57

webbird
Administrator

Re: Help us fill the new Droplets download page!

I checked the droplet and found an error:

for($i=0;$i<$xsize;$i++)
{for($j=0;$j<$ysize;$j++)

Neither $xsize nor $ysize are set anywhere, so you'll get:

Notice: Undefined variable: xsize


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

#7 09.02.2016 14:00:34

webbird
Administrator

Re: Help us fill the new Droplets download page!

I have masked (commented out) the for() mentioned above and replaced the eregi() and added the droplet to our list.

http://addons.wbce.org/pages/droplets.php

Would be great to fix the for()!


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

Fußzeile des Forums

up