how to make new image handler

Author Message

Marek TryliƄski

Tuesday 27 May 2008 6:08:15 am

hi

i need to have an image class, that rotates images, do two layers, one in greyscale etc

i made in php a proper function

and i added it to standard image gd handler in lib directory

how can i clear the kernel and move my code outside lib directory?

i tried this:

in image.ini

#[ImageConverterSettings]
#ExtensionList[]=ws_image
#ImageConverters[]
#ImageConverters[]=WS

#[WS]
#Name=WS
#IsEnabled=true
#Handler=ezimagegd

can you help me?

this is my function (that works in ez)

function przypinka( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData )
{
$polaroid=imagecreatefrompng('/var/plain_site/storage/polaroid.png');
$polaroidSzary=imagecreatefrompng('/var/plain_site/storage/polaroid.png');
$tlo=imagecreatefrompng('/var/plain_site/storage/tlo.png');
$tloBig=imagecreatefrompng('/var/plain_site/storage/tloBig.png');
$plaster=imagecreatefrompng('/var/plain_site/storage/plaster.png');
$tloKolor=imagecolorallocate($tlo,241,241,241);
$szary=$imageObject;
$kolor=$imageObject;
imagecopy($tlo, $polaroid, 24, 42, 0,0,252,237); //wkleja ramke na tlo
imagecopy($tlo, $szary, 34, 53, 0,0,229,213); //wkleja zdjecie swiadka do tla
$zastap = imagecolorallocate($tlo, 241, 241, 241);
imagecolortransparent($tlo,$zastap);
imagefilter($tlo,IMG_FILTER_GRAYSCALE);
$zastap = imagecolorallocate($tlo, 240, 240, 240);
imagecolortransparent($tlo,$zastap);
imagecopy($polaroid, $kolor, 10, 11, 0,0,229,213); //wkleja zdjecie swiadka do ramki
$polaroid=imagerotate($polaroid, 8,-1); // obreca ramke ze zdjeciem
$szer=ImageSX($polaroid); $wys=ImageSY($polaroid);//potrzebne bo obracanie zmienia rozmiar obrazka
imagecopy($tlo, $polaroid, 0, 9, 0,0,$szer,$wys); //wkleja obrocona ramke do tla
imagecopy($tlo, $plaster, 154, 10,0,0,120,90); //wkleja plasterek
imageantialias($tlo, true);
imagecopyresampled($tloBig,$tlo,0,0,0,0,560,560,280,280);
imagecopyresampled($tlo,$tloBig,0,0,0,0,280,280,560,560);
$tloSzare=imagecreatetruecolor(280,280);
$szarosc = imagecolorallocate($tloSzare, 248, 248, 248);
imagefill($tloSzare, 0, 0, $szarosc);
imagecopyresampled($tloSzare,$tlo,0,0,0,0,280,280,280,280);
return $tloSzare;
}

--
http://trylik.pl/kategorie/ez-publish/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:16:44
Script start
Timing: Jan 18 2025 15:16:44
Module start 'layout'
Timing: Jan 18 2025 15:16:44
Module start 'content'
Timing: Jan 18 2025 15:16:45
Module end 'content'
Timing: Jan 18 2025 15:16:45
Script end

Main resources:

Total runtime0.8229 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 587.9141152.6250
Module start 'layout' 0.00530.0028 740.539139.4453
Module start 'content' 0.00810.8133 779.9844445.0078
Module end 'content' 0.82140.0014 1,224.99228.1641
Script end 0.8228  1,233.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3873160.0002
Check MTime0.00130.1591160.0001
Mysql Total
Database connection0.00060.072210.0006
Mysqli_queries0.777494.4711460.0169
Looping result0.00040.0530440.0000
Template Total0.791996.220.3960
Template load0.00160.199720.0008
Template processing0.790396.038720.3951
Template load and register function0.00020.019210.0002
states
state_id_array0.00120.140810.0012
state_identifier_array0.00100.126620.0005
Override
Cache load0.00140.1738510.0000
Sytem overhead
Fetch class attribute can translate value0.00050.066210.0005
Fetch class attribute name0.00050.062010.0005
XML
Image XML parsing0.00010.015410.0001
class_abstraction
Instantiating content class attribute0.00000.000510.0000
General
dbfile0.00060.0751100.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs