Search found 47 matches

by Mahir
2016-12-01T05:56:23-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

thanks for replay,
it is working for fill,but when I try same code for font-size,do not working,like this:

// Remove existing font-size attributes
$svg = preg_replace(
'/font-size="?"/'
,''
,$svg
);

$svg = preg_replace(
'/id="id-3"/'
,'font-size="200px"'
,$svg
);


exactly,remove font size ...
by Mahir
2016-11-29T16:39:36-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

I found solution,I make changes, and display me on browser,but when i try save,not save changes.
maybe I need add something in svg file,but I do not know what.
changes are ignored in librsvg.I think I need add tipe="WHAT I NEED PUT HERE"

THIS IS CODE:

<?php

$usmap = 'svg/new.svg';
$im = new ...
by Mahir
2016-11-29T04:34:57-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

can someboy help me pls?
by Mahir
2016-11-28T16:39:52-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

hello gringo 974,
now I have new tipe svg file without <style></style> inside file,
so when I try preg_replace like this it not working:

<?php

$svg = preg_replace(
'/id="id-1" fill="#([0-9a-f]{6})/'
,'id="id-1" fill="#333'
,$svg

);

?>

this is now svg file:

<?xml version="1.0" encoding ...
by Mahir
2016-11-23T11:11:30-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

this is corect cod:

<?php

$usmap = 'mahir.svg';
$im = new Imagick();
$svg = file_get_contents($usmap);

$svg = preg_replace(
'/.cls-3{fill:#([0-9a-f]{6});}/'
,'.cls-3{fill:aqua;}'
,$svg
);
echo $svg;

$im->readImageBlob($svg);

$im->setImageFormat("png24");
$im->resizeImage(50, 45, imagick ...
by Mahir
2016-11-23T11:08:35-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

BRABO gringo974 now everything working perfect !!!!!
Thank you.
by Mahir
2016-11-23T09:11:37-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

I fix it,
now preg_replace working perfect,but still not save images with colors,just save black color of fill,
but when I try "echo $svg" display svg image with changed color.
I thing problem is there:

$im->readImageBlob($svg);/////////// do no completly fill object "$im" with "$svg" !!!!

<?php ...
by Mahir
2016-11-23T08:19:33-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

pls just save this as index.php :

<?php

$usmap = 'mahir.svg';
$im = new Imagick();
$svg = file_get_contents($usmap);

$svg = preg_replace(
'/.cls-1{fill:red;}/'//on this this line is working,because when I try red color display me black fill on "echo",
,'/.cls-1{fill:aqua;}/'//possible problem ...
by Mahir
2016-11-23T06:54:38-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

when I try display $svg ,
display me image with black fill on cls-1
by Mahir
2016-11-23T06:53:16-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

still not working but I think you can fix it:
can you pls check cod:

<?php

$usmap = 'images/mahir.svg';
$im = new Imagick();
$svg = file_get_contents($usmap);

$svg = preg_replace(
'/.cls-1{fill:red;}/'//on this this line is working,because when I try red color display me black fill on "echo ...
by Mahir
2016-11-23T04:15:58-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

sorry I try like this,as you say but still not working,

$svg = preg_replace(
'/.cls-1{fill:red;}/'
,'/.cls-1{fill:yellow;}/'
,$svg
);


when I save show me black fill.

I am trying make editor in php, to change svg fill and save in png.
by Mahir
2016-11-23T04:11:50-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

<?php

$usmap = 'images/mahir.svg';
$im = new Imagick();
$svg = file_get_contents($usmap);

$svg = preg_replace(
'/.cls-1{fill:#([0-9a-f]{6})/'
,'/.cls-1{fill::red/'
,$svg
);

$im->readImageBlob($svg);

$im->setImageFormat("png24");
$im->resizeImage(720, 445, imagick::FILTER_LANCZOS, 1); /*Optional ...
by Mahir
2016-11-22T11:20:33-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

yes this is my svg:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1645.9 589.78">
<defs>
<style>.cls-1{fill:red;}.cls-1,.cls-2,.cls-3{stroke:#fff;stroke-miterlimit:10;}.cls-3{fill:#207ab2;}
</style ...
by Mahir
2016-11-22T10:29:40-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

can somebody help me please
by Mahir
2016-11-22T07:54:44-07:00
Forum: Developers
Topic: change image color in svg format and save to png or jpg
Replies: 29
Views: 57304

Re: change image color in svg format and save to png or jpg

okay, undarstund.
But which sequence appear in my SVG?