|
And please do not post the same question in multiple forums.
|
|
|
|
|
|
Hi Guys,
Hoping someone can help me out. I'm trying to display a thumbnail of an image but for some reason I can't seem to get the naturalHeight/naturalWidth or heigh/width of the image. I'm using the RadAsyncUpload control from Telerik in a Ajax environment. during debugging I can see all of the other details about the file but the height/widths are always 0.
Here's my script
<pre> <script type="text/javascript">
function OnClientFileSelected(sender, args) {
if ($telerik.isIE9 || $telerik.isIE8 || $telerik.isIE7) {
var input = args.get_fileInputField();
if (sender.isExtensionValid(input.value)) {
var img = document.createElement("img");
var thumbnail = document.getElementById("thumbnail");
thumbnail.appendChild(img);
if (img) {
img.style.visibility = "";
img.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = input.value;
}
}
}
else {
var file = args.get_fileInputField().files.item(args.get_rowIndex()),
index = 0;
while (!file) {
file = args.get_fileInputField().files.item(index);
index++;
}
var $row = $telerik.$(args.get_row());
showThumbnail(file, $row);
}
}
function showThumbnail(file, row) {
var image = document.createElement("img"),
thumbnail = document.getElementById(row.context.id),
breakLine = document.createElement("br");
image.file = file;
thumbnail.appendChild(breakLine);
thumbnail.appendChild(image);
var reader = new FileReader()
reader.onload = (function (aImg) {
return function (e) {
aImg.src = e.target.result;
};
}(image))
var ret = reader.readAsDataURL(file),
canvas = document.createElement("canvas");
ctx = canvas.getContext("2d");
image.onload = function () {
ctx.drawImage(image, 10, 10, 150, 180);
}
if (image.naturalWidth > image.naturalHeight) {
if (image.naturalWidth > MAX_WIDTH) {
height *= MAX_WIDTH / image.naturalWidth;
width = MAX_WIDTH;
}
} else {
if (image.naturalHeight > MAX_HEIGHT) {
width *= MAX_HEIGHT / image.naturalHeight;
height = MAX_HEIGHT;
}
}
var MAX_WIDTH = 800,
MAX_HEIGHT = 600,
width = image.naturalWidth,
height = image.naturalHeight;
canvas.width = width;
canvas.height = height;
var dataurl = canvas.toDataURL("image/png");
}
</script>
|
|
|
|
|
|
Create a js program that will add, subtract, divide, multiply 2 numbers then sum and difference must displayed on a modal the product anf quitient must be printed on the page
|
|
|
|
|
OK, I have done that. Next question please.
|
|
|
|
|
Thanks. Now submit it to myteacher@someschool.edu and say it is for Mr. I. M. Lazy.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I dont care. Just shut up ok 😊
|
|
|
|
|
Rhiz Mariel Diesta wrote: I dont care. We can agree on that.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
This is very easy to do. However, I am concerned at the laziness and rudeness you have shown. All you did is post your homework question but were too lazy to even ask something specific? Why is that?
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
GobblesGobbles wrote: too lazy
Look at that, a self-answering question.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
What is the code of this? Using notepad++
-> Create a js program that uses one variable "nme" this variable mustt have 5 elements. Data is your choice
|
|
|
|
|
There is an answer in the question itself,
Quote: one variable "nme" this variable mustt have 5 elements
That is an array, and secondly, in JavaScript data(type) is not even there. The following is all needed,
var nme = [
"one", "two", "three", "four", "five"
];
You can work out with other data types, and see how they work (such as having strings, numbers and other objects in a single array).
Array - JavaScript | MDN
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
|
Why do you expect people to do all your work for you? Very rude.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
For your information I,m taking Business management,thats why Im asking that question , Because i dont really have idea in java or anything related in programming. I think this site its free to ask any thing right ? And you dont care what i ask.Youre wasting your time to reply in my question
|
|
|
|
|
Rhiz Mariel Diesta wrote: i dont really have idea in java or anything related in programming That's fine. But we can't teach you everything in this forum so you'll have to do some learning and research so you can do what you need. We can't just write your code for you and hand it to you and have it do what you need. It is much more complicated than that.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I ran the following JavaScript code:
alert( "browers is " + navigator.appName );
The browser I was using is Chrome. I expected to get the string Google Chrome but instead I got:
Am I missing something? I am thinking that my security software is changing the name of the string to protect my system and/or my privacy. Is that right?
Thanks,
Bob
|
|
|
|
|
|
It is true that you should check to see if a browswer supports the feature you wish to use. As for the fact that the alert returns Nestscape goes back to the history of Javascript. Here is a quick Google research post (hope you can see why it returns Netscape'
'JavaScript, not to be confused with Java, was created in 10 days in May 1995 by Brendan Eich, then working at Netscape and now of Mozilla. JavaScript was not always known as JavaScript: the original name was Mocha, a name chosen by Marc Andreessen, founder of Netscape.Jun 27, 2012'
|
|
|
|
|
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
...
Do not rely on this property to return the correct browser name. In most browsers (like Firefox, Chrome, Safari, Opera and Internet Explorer) the returned string is "Netscape".
You should generally avoid browser detection, and use feature detection instead:
Browser Detection (and What to Do Instead)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hey guys. New to angular, so this might be a noobish question:
I have an array of objects, each containing variables like "country", "site", etc.
I want my list to show all the instances of only one variable. The following test works:
<pre>
<tr ng-repeat="x in testSites | orderBy:myOrderBy">
<td>{{x.country}}</td>
</tr>
However, I want to use a variable where "country" is used above. Like this: {{x.aspect}}
I've tested the 'aspect' variable, and it works, having the value 'country' as default, so it should show the exact same result, but all I get is an empty list.
Thanks a lot in advance.
|
|
|
|
|
I am unable to create a simple dialog box using jQuery for some reason. I imported a reference to jQuery3.2.1.js. I am trying to call a div with a class named "dialogue-box" in a section with the id called "dialogue".
Here is my code:
$(document).ready(function(){
$("#dialogue .dialogue-box").dialog({
title:"MENU",
width:500,
height:600,
modal:true
});
});
if anyone could please let me know what i am doing wrong, I would apperciate it.
Thanks,
|
|
|
|
|
You have different spellings of dialog(ue) .
|
|
|
|
|
dialog is part of jQueryUI, not jQuery, so are you adding a reference to that also? After your reference to jQuery? Are you getting error messages in the console?
Dialog | jQuery UI[^]
|
|
|
|