croppie issue with new font
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 |
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 |
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
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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