0
私はキャンバス上にRaphaelの画像を持っています。今私はraphael.serializeプラグインとsvgを生成したが、私はクリップ直腸作業を得ることができません。 。私は、ビューボックス= "」$のJSON [$ I]を使用しようとしましたraphaelのclip-rectプロパティを使用して、生成されたsvg画像の結果を取得します。
var object = {
type: node.type,
width: node.attrs['width'],
height: node.attrs['height'],
x: node.attrs['x'],
y: node.attrs['y'],
src: node.attrs['src'],
clip: node.attrs['clip-rect'],
transform: node.transformations ? node.transformations.join(' ') : ''
}
:
for ($i=0; $i <= count($json); $i++) {
if ($json[$i]['type'] == "image") {
$base64 = base64_encode(file_get_contents($json[$i]['src']));
$output .= '<image overflow="visible" x="'.$json[$i]["x"].'" y="'.$json[$i]["y"].'" width="'.$json[$i]["width"].'" clip-rect="'.$json[$i]["clip"].'" height="'.$json[$i]["height"].'" transform="'.$json[$i]["transform"].'" preserveAspectRatio="none" xlink:href="data:image/png;base64,'.$base64.'"></image>';
}
}
とここで変更シリアル化プラグインの一部:作成したJSONをループすることをPHPスクリプトからthetの一部["clip"]。 "" clip = "'$ json [$ i] [" clip "]。" "しかし、結果は得られません。
どうすればこの問題を解決できますか?
私は 'clip-path =" '。$ json [$ i] ["clip-rect"]を得るために私のPHPスクリプトを変更しましたが、私は結果を得ることができません。私の問題を解決するためのガイドラインを教えてください。私はsvgの初心者です – gerpaick
raphael.serializeは、クリップパスのシリアライズを処理していないようです。なぜその拡張機能の作成者がトップレベルのsvg要素でXMLSerializerを使用しただけではないのか分かりません。ありがとう、しかし、私はそれがうまく動作すると思うhttp://stackoverflow.com/questions/227208/what-is-the-best-way-to-serialize-svg-from-the-client-dom/227754#227754 –
を参照してくださいIEのブラウザ – gerpaick