Bonjour,
Je suis en train de développer un projet de jeu en vectoriel et je suis sur mon premier blocage depuis maintenant 1 semaine je tourne en rond dessus sans comprendre pourquoi ca ne fonctionne pas.
Voici le soucis, j'ai un fichier SVG développé sous Illustrator qui ressemble à ca:
Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/"> <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/"> <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/"> <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/"> <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/"> <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/"> <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/"> <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/"> ]> <svg version="1.1" xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 800 600" enable-background="new 0 0 800 600" xml:space="preserve" id="test"> ... <g id="portrait"> <path fill="#767676" d="M70.5,21.5c-26.6,0-48.1,24.4-48.1,51c0,26.6,21.5,48.1,48.1,48.1s48.1-21.5,48.1-48.1 C118.6,45.9,97,21.5,70.5,21.5z M70.5,120.7c-25,0-45.3-23.2-45.3-48.2c0-25,20.3-48.2,45.3-48.2s45.3,23.2,45.3,48.2 C115.8,97.6,95.5,120.7,70.5,120.7z"/> <path fill="#908F8F" d="M70.5,17.5c-27.7,0-52.2,27.3-52.2,55s24.5,52.2,52.2,52.2s52.2-24.5,52.2-52.2S98.2,17.5,70.5,17.5z M70.5,120.5c-26.5,0-48-21.5-48-48c0-26.5,21.5-50.8,48-50.8s48,24.3,48,50.8C118.4,99,97,120.5,70.5,120.5z"/> <image overflow="visible" width="225" height="200" data="<?php echo $_SESSION['portrait']; ?>"></image> </g> ... </svg>
J'ai de l'autre côté mon fichier html sur lequel j'exécute mes requêtes php/mysql.
Et je ne sais pas comment faire pour que mes variables puissent être lues dans mon document SVG.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 <!DOCTYPE html> <html> <head> <link href="design/jeu/jeu.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../scripts/jquery.min.js"></script> <script type="text/javascript" src="../scripts/snap.svg-min.js"></script> </head> <body> <div> <?php $requete = Bdd::connectBdd()->prepare('SELECT * FROM bipppppppp WHERE id = :id'); $requete-> execute(array('id'=> $_SESSION['id'])); while($membre = $requete->fetch(PDO::FETCH_ASSOC)){ $_SESSION['portrait'] = Avatar::membre(Membre::info($membre['id'], 'id_avatar')); $imageSize = getimagesize( $_SESSION['portrait'], $imageSize ); $mime = mime_content_type($_SESSION['portrait']); $perso = base64_encode(file_get_contents($_SESSION['portrait'])); $_SESSION['portrait'] = 'data:' . $mime . ';base64,' . $perso; } ?> <script> var s = Snap(); Snap.load("../modules/jeu/test.svg", function ( loadedFragment ) { s.append( loadedFragment ); } ); </script> </div> </body> </html>
Car quelle que soit ma méthode d'écriture de ma variable dans le dom svg j'ai une erreur mal formé quand j'inspecte l'élément et je trouve pas la solution qui me permettrait d'afficher mon image "portrait" par dessus l'image pleine page de test.svg.
Merci de m'avoir lu jusque là
Je compte vraiment sur vous car je suis réellement bloqué dans l'état actuel de mes connaissances.
++
Partager