I am using Jcrop on an image that is resized with css for uniformity.
JS
<script type="text/javascript">
$(window).load(function() {
//invoke Jcrop API and set options
var api = $.Jcrop('#image', { onSelect: storeCoords, trueSize: [w, h] });
api.disable(); //disable until ready to use
//enable the Jcrop on crop button click
$('#crop').click(function() {
api.enable();
});
});
function storeCoords(c) {
$('#X').val(c.x);
$('#Y').val(c.y);
$('#W').val(c.w);
$('#H').val(c.h);
};
</script>
HTML
<body>
<img src="/path/to/image.jpg" id="image" class="img_class" alt="" />
<br />
<span id="crop" class="button">Crop Photo</span>
<span id="#X" class="hidden"></span>
<span id="#Y" class="hidden"></span>
<span id="#W" class="hidden"></span>
<span id="#H" class="hidden"></span>
</body>
CSS
body { font-size: 13px; width: 500px; height: 500px; }
.image { width: 200px; height: 300px; }
.hidden { display: none; }
I need to set the h and w variables to the size of the actual image. I tried using the .clone() manipulator to make a copy of the image and then remove the class from the clone to get the sizing but it sets the variables to zeros.
var pic = $('#image').clone();
pic.removeClass('image');
var h = pic.height();
var w = pic.width();
It works if I append the image to an element in the page, but these are larger images and I would prefer not to be loading them as hidden images if there is a better way to do this. Also removing the class, setting the variables, and then re-adding the class was producing sporadic results.
I was hoping for something along the lines of:
$('#image').removeClass('image', function() {
h = $(this).height();
w = $(this).width();
}).addClass('image');
But the removeClass function doesn't work like that :P
Programming challenge: Given a set of integers [1, 2, 3, 4, 5] I would like to generate all possible k-combinations in ascending size order in Java; e.g.
[1], [2], [3], [4], [5], [1, 2], [1, 3] ... [1, 2, 3, 4, 5]
It is fairly easy to produce a recursive solution that generates all combinations and then sort them afterwards but I imagine there's a more efficient way that removes the need for the additional sort.
Hi,
The limitation of one document in MongoDB is 4Mo. I have some documents really heavy with a lot of data.
How I know my document's size inside MongoDB with the ruby driver ?
Hi. I'm using the jQuery UI Button control but don't seem to be able to adjust the size (width and height). Here's the API documentation. I tried setting a STYLE attribute on it, but then the LABEL wasn't centered correctly. Thanks.
Im new to testing with cucumber and have a question regarding the size of a 'Feature'.
Assume you can add a collection of items to a list and do the usual CRUD , is it preferred to create one feature for this complete set of CRUD actions or a feature for each?
What is the preferred/accepted method ?
At what point does an action become a feature itself ?
Hi all. How can I get the size of a versioned file/files? This seems to be a very common operation but I can't find how (Am I missing something?). Well, I can get it indirectly by catting it and count the bytes but this is very slow.
Any help would be appropriated.
Hi,
i have a webpage with table and in it images,
i would like to add the option to increase/decrease image size, how could i do that?
This is what it is for now, http://www.ursic-ei.si/1.html
I am writing a an swt app that has an embeded GLCanvas and I wanted to be able to find out the size of the current cursor, is this possible? And if I cannot get it from JOGL then is it possible from either swt or awt?
I am trying to optimize the database buffer size, but i am finding the
SHOW TABLE STATUS
rather cryptic. I know that the data length is "165719261184"- how do i convert that into actual megabytes?
I'm trying to build a basic POP3 mail client in C/++, but I've run into a bit of an issue. Since you have to define the buffer size when building the program, but a message can be arbitrarily large, how do you, say, get the mail server to send it to you in parts? And if this isn't the correct means of solving the problem, what is?
And while I'm here, can anyone confirm for me that RFC 2822 is still the current document defining email layout?
Thanks
Is there some kind of Session size limitation or advisable value to not to surpass ?
In my web application i create few DataTables to store user selections which are stored in session until user approves selections so i add those values to database.
problem is i don't know whether session is reliable enough to keep few objects in or not ?
thanks
I guess the title contains my whole question. How can I draw a string onto an image in Flash and .NET/GDI+ respectively and gain the same result? (I'm not a Flash programmer myself and it is rather hard to find out about what kind of unit Flash uses by googling for something like "flash font size"...) Ekeforshus
Is there any way to detect the contents height/width in the WebBrowser control? I'd like to save the contents to an image but only at the size of the actual contents.
Thank you in advance.
I would like to proportionally decrease the size of all text in a WebView as easily as possible. I've tried android:textSize="..." without success. Api Level 7.
Hi,
I have file upload UI element in which the user will upload images. Here I have to control the validate the height and width of the image in client side. Is it possible to find the size of the image having only the file path in JS?
Hi,
I am looking for some function like this:
GetFontSize(<Font Name>, <Sample Character>, <Sample Character Width>,
<Sample Character Height>)
which must return the font size,
Is this possible in delphi?
if an array of size n has only 3 values 0 ,1 and 2 (repeated any number of times) what is the best way to sort them. best indicates complexity. consider space and time complexity both
Hello, I want to host a web application on a private JVM they offer 32, 64, 128, 256 MB plans.
My web application uses Spring. And I store some objects for every logged in user session.
My question is: How can I profile my web app to see how much heap size it needs so I can choose a plan?, How can I simulate hundreds of users logged in at the same time?
I'm developing the application using Netbeans 6.7 Java 1.6 Tomcat 6.0.18
Thank you.
Hey, I have a texture loaded with glTextImage2D.
I want to get the texture's size after it was loaded to the VRAM, what do I need to do?
My internal format is RGBA and the texture's format varies.
Hi There,
let me rewrite my question, I have a Ajax Accordion in my web site, Users can add images, in Accordion,I keep the thumbnail and fullsize image's path in Sql Server table, Users can see the thumbnail, and when they click the thumbnail, I use a ModalPopupExtender that open an asp panel to show the full size image, with progress image or preload bar
What is the best way to achieve this?
Thanks in advance
Hi,
I am trying to upload images using a webservice from silverlight. I am first converting the images into stram of bytes and then trying to upload them. I am able to upload image of size 2.5 MB. But not more than that.It gives me "The remote server returned an error: NotFound" error.
What could be the reason.
i have a page that have some control on it. i add some element with programming in code behind.
how can i this:
when i add control that is larger than its container, show Scroll?(i used ScrollViewr but i don't know size of container because it resize in Run-Time to fill Browser)