gtkforphp / cairo

PHP extension for Cairo Graphics Library
Other
27 stars 19 forks source link

Fix config.w32 #24

Closed Jan-E closed 7 years ago

Jan-E commented 7 years ago

Recent versions of libcairo requite libpng.lib to be linked

Jan-E commented 7 years ago

Background: I am adding php_cairo.dll to all my PHP 5.x builds at https://www.apachelounge.com/viewtopic.php?t=6359

Example: https://phpdev.toolsforresearch.com/php-5.6.27-Win32-VC11-x86.htm https://phpdev.toolsforresearch.com/php-5.6.27-Win32-VC11-x86.zip

Jan-E commented 7 years ago

I guess this will fix your Appveyor builds as well: https://ci.appveyor.com/project/auroraeosrose/cairo/build/0.3.2.19/job/olg8c565yqq8aj00

auroraeosrose commented 7 years ago

looks good, but I still have a segfault on bad ttf files I have to fix yet :)

Jan-E commented 7 years ago

OK. Wish you good luck.

BTW: the reason I stumbled over the cairo extension was that I was looking for a way to convert SVG's on the fly to PNG. In the end I chose for a system call to inkscape. But just curious: is it possible to import an svg in the cairo extension and write it as png?

This was the (generated SVG: https://pwnfi2.spp.e-lijst.nl/images/dwars.php?y=Juridische+Zaken&z1=man&z2=vrouw&x1=tot+24+jaar&11=&12=&x2=25+-+34+jaar&21=&22=&x3=35+-+44+jaar&31=1.0&32=0.8&x4=45+-+54+jaar&41=&42=&x5=55+en+ouder&51=1.0&52=0.8421&x6=totaal&61=2.0&62=1.6421

And this is the same, generated by a system call to inkscape, the moment you load it: https://pwnfi2.spp.e-lijst.nl/images/svg2png.php?img=1&uri=https://pwnfi2.spp.e-lijst.nl/images/dwars.php&y=Juridische+Zaken&z1=man&z2=vrouw&x1=tot+24+jaar&11=&12=&x2=25+-+34+jaar&21=&22=&x3=35+-+44+jaar&31=1.0&32=0.8&x4=45+-+54+jaar&41=&42=&x5=55+en+ouder&51=1.0&52=0.8421&x6=totaal&61=2.0&62=1.6421

swen100 commented 7 years ago

In the short: as far as I know there is no such possibility.

Jan-E commented 7 years ago

Pity. Thanks for answering.

auroraeosrose commented 7 years ago

ah, actually you can do this if we also had the librsvg extension tied in.... paging @mgdm ?? do you still have that wrapper around?

because librsvg will parse in the svg and then it can export it to a cairo context - which you can then render as a png (hello graphics library magic) - the hard part is parsing out the svg

you could also do a port of this library -> http://cairosvg.org/ from python to PHP , basically it parses the svg and turns it into a cairo context with raw cairo (ewww but it would work)

auroraeosrose commented 7 years ago

https://github.com/mgdm/php-rsvg - hah, it does exist

SO @Jan-E you can use that extension with cairo - load the svg, put it into a cairo context, export as a png :)

Although... I may have @mgdm move it to the gtkforphp org here and it needs tests and...

swen100 commented 7 years ago

cool :)

Jan-E commented 7 years ago

If I look at the config.w32 it does not compile out-of-the-box on Windows, but I will have to compile librsvd first to test that.

auroraeosrose commented 7 years ago

we'll get it fixed if it's broken :( it's pretty old