作成しよう
ステップ1 - ユーザーがAjax、Raphael、およびRaphael freetransformで画像をアップロードできるようにします。Raphael svgの画像をマージする
ステップ2 - マージアップロード画像から1つの画像を表示するには、ボタンをクリックします。 (質問):Resource interpreted as image but transferred with MIME type text/html
error: image "" not found
:私はそんなに私はCanvgを使用していますが、あまりにもしかしにconsole.logを取得ラファエルSVG 1 2 3、
を変換する同様のポストを発見した 。
解決方法を教えてください。または他の方法で同じ目標(アップロードから1つのpng/jpegにいくつかのRaphael svgイメージを変換する)に達する方法を手がかりにすることができますか?
ありがとうございます!
ステップ1
// upload images and ajax show in page
var paper = Raphael($('.upload_img')[0], 400, 200);
$('.upload_btn').click(function(){
...
$.ajax({
type: "POST",
url: "index.php",
data: fd,
processData: false,
contentType: false,
success: function(html){
var session = ..., file = ... type = ...;
function register(el) {
// toggle handle
};
var img = new Image();
img.onload = function(){
var r_img = paper.image('img/product/tmp/'+session+'/'+file+type, 0, 0, 200, 200);
register(r_img);
};
img.src = 'img/product/tmp/'+session+'/'+file+type;
}
});
});
ステップ2
// merge and show
$('.merge_btn').click(function(){
var upload_svg = $('.upload_img').html();
canvg('canvas', upload_svg);
console.log('upload_svg'+upload_svg); //<svg height="200" version="1.1" width="400" xmlns="http://www.w3.org/2000/svg" style="overflow-x: hidden; overflow-y: hidden; position: relative; "><desc></desc><defs></defs><image x="0" y="0" width="200" height="216.91973969631235" preserveAspectRatio="none" href="img/product/tmp/bc4d26ceb620852db36074d351883539/6.jpeg"></image></svg>
// and get error
});
// These code If toggle show Raphael freetransform svg handle, it is work convert several svg handle to one image. but still not found upload image to merge
RaphaelとRaphael freetransformは分かりませんが、エラーは何かが間違っているように見えます。それは画像を見つけることができないので、変換されないように見えます。イメージが正しいディレクトリに保存されていると確信していますか?多分あなたはjsfiddleを作ることができますか? –