# I made PHP viewer for fritzing but

**URL:** <https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444>\
**Category:** advanced\
**Created:** [September 3, 2017, 9:14pm UTC](https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444 "2017-09-03T21:14:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![idleman](https://forum.fritzing.org/user_avatar/forum.fritzing.org/idleman/32/2752_2.png) [@idleman](https://forum.fritzing.org/u/idleman)\
**Post date:** [September 3, 2017, 9:14pm UTC](https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444/1 "2017-09-03T21:14:29Z")

</div>

Hello, i made a Fritzing.class.php file in order to have a viewer for a fzz in svg format.  
Everything work like a charm but i’ve some problem with **rotations of components**.

Instances rotations seem to be defined in the attributes of  
`instance->views->breadboardView->geometry->transform`  
node but the format of it is a mystery for me, i see **9 parameters** like  
`m11="0.707107" m12="0.707107" m13="0" m21="-0.707107" m22="0.707107" m23="0" m31="15.9403"` m32="-2.45825" m33="1"  
for a simple 45° rotation, so far I have deduced by myself the logic of xml but on this data format, i’m lost …  
Any ideas ?

---

<div class="post-metadata">

**Author:** ![sublimeartistry](https://forum.fritzing.org/user_avatar/forum.fritzing.org/sublimeartistry/32/2218_2.png) [@sublimeartistry](https://forum.fritzing.org/u/sublimeartistry)\
**Post date:** [September 4, 2017, 2:15am UTC](https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444/2 "2017-09-04T02:15:51Z")

</div>

I would create a new fritzing sketch and only put one part on the board and set its location to 0, 0 in the inspector and do not rotate it. Then save the sketch and open it in your editor and take note of the numbers. Then I would open the sketch again and turn the part once (45 degrees), save and re-check in the editor and take note of the numbers again. After that I would try moving the part a specified amount using the inspector and again after saving check it in your editor. You should be able to tell what changes take place for each type of move.

---

<div class="post-metadata">

**Author:** ![vanepp](https://forum.fritzing.org/user_avatar/forum.fritzing.org/vanepp/32/4426_2.png) [@vanepp](https://forum.fritzing.org/u/vanepp)\
**Post date:** [September 4, 2017, 3:21am UTC](https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444/3 "2017-09-04T03:21:45Z")

</div>

While I’d probably try Sublimeartistry’s suggestion first, if you want the technical explaination you are looking for transform matrixes in the svg spec. I think that the various editors use different ones and I don’t know what Fritzing does (which is why trying it on Fritzing output is the best bet.)

Peter

---

<div class="post-metadata">

**Author:** ![idleman](https://forum.fritzing.org/user_avatar/forum.fritzing.org/idleman/32/2752_2.png) [@idleman](https://forum.fritzing.org/u/idleman)\
**Post date:** [September 4, 2017, 7:15am UTC](https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444/4 "2017-09-04T07:15:50Z")

</div>

Thanks for your responses.

I’v already tried this manipulation, for 0 0 0 (x,y,r) i’ve a geometry with  
`<geometry z="2.5" x="-0.3095" y="0.4595"/>`  
And no transform subnode (because no rotation)

with a rotation of 45° a transform node appear with  
`<transform m11="0.707107" m12="0.707107" m13="0" m21="-0.707107" m22="0.707107" m23="0" m31="8.74625" m32="-12.3763" m33="1"/>`

It seem position (geometry attirbute) and rotation (transform attributes) are not linked, and position work well in my wiewer, that’s just the transform attributes which are incomprehensible for me, if it’s a transformation matrix there should be only 6 parameters and not 9 ?

---

<div class="post-metadata">

**Author:** ![idleman](https://forum.fritzing.org/user_avatar/forum.fritzing.org/idleman/32/2752_2.png) [@idleman](https://forum.fritzing.org/u/idleman)\
**Post date:** [September 4, 2017, 7:27am UTC](https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444/5 "2017-09-04T07:27:13Z")

</div>

I thought i’m understanding something.  
math matrix is actually composed of 9 parameters but only 6 are useful in our case :

 ![](https://forum.fritzing.org/uploads/default/original/2X/1/105c4e20cb94f8ee06a57d3fa7cb44fb62668801.png)

It seem that m13,m23 and m33 are thoses useless 3 coordinate, i’ll try to transpose other m11,m12,m21,m22,m31,m32 to the 6 parameter of svg matrix.

---

<div class="post-metadata">

**Author:** ![idleman](https://forum.fritzing.org/user_avatar/forum.fritzing.org/idleman/32/2752_2.png) [@idleman](https://forum.fritzing.org/u/idleman)\
**Post date:** [September 4, 2017, 5:31pm UTC](https://forum.fritzing.org/t/i-made-php-viewer-for-fritzing-but/4444/6 "2017-09-04T17:31:40Z")

</div>

It works ! I’ve probably the first web fritzing projet viewer, thanks for your emulation ! 🙂
