croppie issue with new font
up vote
0
down vote
favorite
I have a very weird issue with croppie:
i am using it on this page - sorry the page is in Hebrew...
www.mzungu.co.il/add_article.php the (croppie area opens in pressing the first choose file)
i am using a different font on the image being cropped. the font is in Hebrew and its "Trashim".
The issue is:
The new Font is not working if i add a picture and then press crop.
If i press cop again it works.
If i toggle zoom before first press on 'crop' it works.
If i Paste the input instead of typing it, it works.
Like i said, very weird :(
my code:
<style>
@font-face
font-family: 'Trashim';
src: url('Fonts/Trashim CLM Bold.ttf');
</style>
<script>
$(document).ready(function()
var basic = ;
var width=500;
var height=250;
$(".crop-image").change(function ()
$('#demo-basic').croppie('destroy');
$(".crop_div").css('display':'block');
var reader = new FileReader();
var result = '';
console.log($('#demo-basic'));
basic = $('#demo-basic').croppie(
viewport:
width: width,
height: height
,
// showZoomer: false
);
reader.onload = function (e)
basic.croppie('bind',
url: e.target.result,
// points: [77, 469, 280, 739]
);
;
reader.readAsDataURL(this.files[0]);
);
$('.crop').click(function ()
basic.croppie('result',
type: 'base64',
size: 'viewport',
format: 'png',
circle: false
).then(function (result)
// console.log(result);
var canvas = $("body").find("canvas")[0];
var ctx = canvas.getContext("2d");
var img = new Image;
img.onload = function ()
// ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0);
ctx.drawImage(img, 0, 0);
// ctx.fillStyle = "white";
ctx.fillStyle = "rgba(255, 255, 255, 0.7)";
ctx.fillRect(0, 180, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.font = "25px Trashim";
ctx.textAlign = "center";
ctx.fillText($("[name='article_authors_name']").val(), (width/2), 230);
ctx.font = "30px Trashim";
ctx.fillText($("[name='article_name']").val(), (width/2), 210);
// var c = document.getElementById("alpha");
var d = canvas.toDataURL("image/png");
console.log(d);
$("[name='article_banner']").val(d)
;
img.src = result;
);
);
);
</script>
<div class="form-group crop_div" align="right" dir="rtl">
<input type="hidden" name="article_banner" required/>
<div id="page">
<div id="demo-basic">
</div>
</div>
<div>
<button type="button" class="crop">חיתוך התמונה</button>
</div>
<div align="center">
<canvas id='testCanvas'width=500 height=250 class="final_image_canvas"></canvas>
</div>
</div>
php cropper cropperjs croppie
add a comment |
up vote
0
down vote
favorite
I have a very weird issue with croppie:
i am using it on this page - sorry the page is in Hebrew...
www.mzungu.co.il/add_article.php the (croppie area opens in pressing the first choose file)
i am using a different font on the image being cropped. the font is in Hebrew and its "Trashim".
The issue is:
The new Font is not working if i add a picture and then press crop.
If i press cop again it works.
If i toggle zoom before first press on 'crop' it works.
If i Paste the input instead of typing it, it works.
Like i said, very weird :(
my code:
<style>
@font-face
font-family: 'Trashim';
src: url('Fonts/Trashim CLM Bold.ttf');
</style>
<script>
$(document).ready(function()
var basic = ;
var width=500;
var height=250;
$(".crop-image").change(function ()
$('#demo-basic').croppie('destroy');
$(".crop_div").css('display':'block');
var reader = new FileReader();
var result = '';
console.log($('#demo-basic'));
basic = $('#demo-basic').croppie(
viewport:
width: width,
height: height
,
// showZoomer: false
);
reader.onload = function (e)
basic.croppie('bind',
url: e.target.result,
// points: [77, 469, 280, 739]
);
;
reader.readAsDataURL(this.files[0]);
);
$('.crop').click(function ()
basic.croppie('result',
type: 'base64',
size: 'viewport',
format: 'png',
circle: false
).then(function (result)
// console.log(result);
var canvas = $("body").find("canvas")[0];
var ctx = canvas.getContext("2d");
var img = new Image;
img.onload = function ()
// ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0);
ctx.drawImage(img, 0, 0);
// ctx.fillStyle = "white";
ctx.fillStyle = "rgba(255, 255, 255, 0.7)";
ctx.fillRect(0, 180, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.font = "25px Trashim";
ctx.textAlign = "center";
ctx.fillText($("[name='article_authors_name']").val(), (width/2), 230);
ctx.font = "30px Trashim";
ctx.fillText($("[name='article_name']").val(), (width/2), 210);
// var c = document.getElementById("alpha");
var d = canvas.toDataURL("image/png");
console.log(d);
$("[name='article_banner']").val(d)
;
img.src = result;
);
);
);
</script>
<div class="form-group crop_div" align="right" dir="rtl">
<input type="hidden" name="article_banner" required/>
<div id="page">
<div id="demo-basic">
</div>
</div>
<div>
<button type="button" class="crop">חיתוך התמונה</button>
</div>
<div align="center">
<canvas id='testCanvas'width=500 height=250 class="final_image_canvas"></canvas>
</div>
</div>
php cropper cropperjs croppie
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a very weird issue with croppie:
i am using it on this page - sorry the page is in Hebrew...
www.mzungu.co.il/add_article.php the (croppie area opens in pressing the first choose file)
i am using a different font on the image being cropped. the font is in Hebrew and its "Trashim".
The issue is:
The new Font is not working if i add a picture and then press crop.
If i press cop again it works.
If i toggle zoom before first press on 'crop' it works.
If i Paste the input instead of typing it, it works.
Like i said, very weird :(
my code:
<style>
@font-face
font-family: 'Trashim';
src: url('Fonts/Trashim CLM Bold.ttf');
</style>
<script>
$(document).ready(function()
var basic = ;
var width=500;
var height=250;
$(".crop-image").change(function ()
$('#demo-basic').croppie('destroy');
$(".crop_div").css('display':'block');
var reader = new FileReader();
var result = '';
console.log($('#demo-basic'));
basic = $('#demo-basic').croppie(
viewport:
width: width,
height: height
,
// showZoomer: false
);
reader.onload = function (e)
basic.croppie('bind',
url: e.target.result,
// points: [77, 469, 280, 739]
);
;
reader.readAsDataURL(this.files[0]);
);
$('.crop').click(function ()
basic.croppie('result',
type: 'base64',
size: 'viewport',
format: 'png',
circle: false
).then(function (result)
// console.log(result);
var canvas = $("body").find("canvas")[0];
var ctx = canvas.getContext("2d");
var img = new Image;
img.onload = function ()
// ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0);
ctx.drawImage(img, 0, 0);
// ctx.fillStyle = "white";
ctx.fillStyle = "rgba(255, 255, 255, 0.7)";
ctx.fillRect(0, 180, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.font = "25px Trashim";
ctx.textAlign = "center";
ctx.fillText($("[name='article_authors_name']").val(), (width/2), 230);
ctx.font = "30px Trashim";
ctx.fillText($("[name='article_name']").val(), (width/2), 210);
// var c = document.getElementById("alpha");
var d = canvas.toDataURL("image/png");
console.log(d);
$("[name='article_banner']").val(d)
;
img.src = result;
);
);
);
</script>
<div class="form-group crop_div" align="right" dir="rtl">
<input type="hidden" name="article_banner" required/>
<div id="page">
<div id="demo-basic">
</div>
</div>
<div>
<button type="button" class="crop">חיתוך התמונה</button>
</div>
<div align="center">
<canvas id='testCanvas'width=500 height=250 class="final_image_canvas"></canvas>
</div>
</div>
php cropper cropperjs croppie
I have a very weird issue with croppie:
i am using it on this page - sorry the page is in Hebrew...
www.mzungu.co.il/add_article.php the (croppie area opens in pressing the first choose file)
i am using a different font on the image being cropped. the font is in Hebrew and its "Trashim".
The issue is:
The new Font is not working if i add a picture and then press crop.
If i press cop again it works.
If i toggle zoom before first press on 'crop' it works.
If i Paste the input instead of typing it, it works.
Like i said, very weird :(
my code:
<style>
@font-face
font-family: 'Trashim';
src: url('Fonts/Trashim CLM Bold.ttf');
</style>
<script>
$(document).ready(function()
var basic = ;
var width=500;
var height=250;
$(".crop-image").change(function ()
$('#demo-basic').croppie('destroy');
$(".crop_div").css('display':'block');
var reader = new FileReader();
var result = '';
console.log($('#demo-basic'));
basic = $('#demo-basic').croppie(
viewport:
width: width,
height: height
,
// showZoomer: false
);
reader.onload = function (e)
basic.croppie('bind',
url: e.target.result,
// points: [77, 469, 280, 739]
);
;
reader.readAsDataURL(this.files[0]);
);
$('.crop').click(function ()
basic.croppie('result',
type: 'base64',
size: 'viewport',
format: 'png',
circle: false
).then(function (result)
// console.log(result);
var canvas = $("body").find("canvas")[0];
var ctx = canvas.getContext("2d");
var img = new Image;
img.onload = function ()
// ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0);
ctx.drawImage(img, 0, 0);
// ctx.fillStyle = "white";
ctx.fillStyle = "rgba(255, 255, 255, 0.7)";
ctx.fillRect(0, 180, canvas.width, canvas.height);
ctx.fillStyle = "black";
ctx.font = "25px Trashim";
ctx.textAlign = "center";
ctx.fillText($("[name='article_authors_name']").val(), (width/2), 230);
ctx.font = "30px Trashim";
ctx.fillText($("[name='article_name']").val(), (width/2), 210);
// var c = document.getElementById("alpha");
var d = canvas.toDataURL("image/png");
console.log(d);
$("[name='article_banner']").val(d)
;
img.src = result;
);
);
);
</script>
<div class="form-group crop_div" align="right" dir="rtl">
<input type="hidden" name="article_banner" required/>
<div id="page">
<div id="demo-basic">
</div>
</div>
<div>
<button type="button" class="crop">חיתוך התמונה</button>
</div>
<div align="center">
<canvas id='testCanvas'width=500 height=250 class="final_image_canvas"></canvas>
</div>
</div>
php cropper cropperjs croppie
php cropper cropperjs croppie
asked Nov 10 at 20:01
Ziv Oriol
55
55
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242915%2fcroppie-issue-with-new-font%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown