Ajax upload, Jcrop and hidden divs

Ajax upload, Jcrop and hidden divs

Working on the same project as mentioned in a previous post, Using the Loader class in AS3, I came across an issue using a Ajax upload script and the jQuery image cropping plugin, Jcrop.

The form had an image within a hidden div, as I didn't want to display the image until the user had uploaded an image. Upon the Ajax upload script onComplete function being successful, Jcrop would be invoked and the image div would be displayed.

var uploader = new qq.FileUploader({
	allowedExtensions: ['jpg', 'jpeg', 'png'],
	element: document.getElementById('file-uploader'),
	action: '/FileUpload.ashx?id=' + $('#contestantId').val(),
	onComplete: function(id, fileName, responseJSON) {
		$('#imgupload').attr('src', responseJSON.url).load(function() {
			$(this).Jcrop({
                        	onSelect: updateCoords,
                        	boxHeight: 200,
                            	aspectRatio: 23 / 28
                        });
                        $('#workingImage').val(responseJSON.file);
                        $('#image-div').show();
                        $('#file-uploader').hide();
		});
	}
});

This worked fine in Firefox, but would fail in Internet Explorer. The issue seemed to be that the image div was hidden until the upload was successful.

This was overcome by not having the image div hidden, and creating a 1x1.gif file to be the image placeholder.

var uploader = new qq.FileUploader({
	allowedExtensions: ['jpg', 'jpeg', 'png'],
	element: document.getElementById('file-uploader'),
	action: '/FileUpload.ashx?id=' + $('#contestantId').val(),
	onComplete: function(id, fileName, responseJSON) {
		$('#imgupload').attr('src', responseJSON.url).load(function() {
			$(this).Jcrop({
                        	onSelect: updateCoords,
                        	boxHeight: 200,
                            	aspectRatio: 23 / 28
                        });
                        $('#workingImage').val(responseJSON.file);
                        $('#file-uploader').hide();
		});
	}
});

1 comment (Add your own)

1. AlbertDum wrote:
The prostate is an essential portion of a male's the reproductive system. It secretes fluids that help the transportation and activation of sperm. The men's prostate can be found just as you're watching rectum, below the bladder and around the urethra. When there is prostate problem, it is usually really miserable and inconvenient for that patient as his urinary product is directly affected.

The common prostate medical problems are prostate infection, enlarged prostate and cancer of prostate.



Prostate infection, also referred to as prostatitis, is the most common prostate-related problem in men younger than 55 years old. Infections in the prostate gland are classified into four types - acute bacterial prostatitis, chronic bacterial prostatitis, chronic abacterial prostatitis and prosttodynia.

Acute bacterial prostatitis could be the least common of kinds of prostate infection. It is brought on by bacteria based in the large intestines or urinary tract. Patients may experience fever, chills, body aches, back pains and urination problems. This condition is treated by utilizing antibiotics or non-steroid anti-inflammatory drugs (NSAIDs) to help remedy the swelling.

Chronic bacterial prostatitis is often a condition connected with a particular defect inside gland and also the persistence presence of bacteria within the urinary tract. It can be brought on by trauma to the urinary tract or by infections from other parts of the body. A patient may experience testicular pain, lower back pains and urination problems. Although it is uncommon, it could be treated by removal of the prostate defect then the employment antibiotics and NSAIDs to help remedy the redness.

Non-bacterial prostatitis accounts for approximately 90% of prostatitis cases; however, researchers have not even to establish the sources of these conditions. Some researchers believe that chronic non-bacterial prostatitis occur because of unknown infectious agents while other believe intensive exercise and high lifting may cause these infections.

Maintaining a Healthy Prostate

To prevent prostate diseases, an appropriate diet is important. These are some in the things you can do to keep your prostate healthy.

1. Drink sufficient water. Proper hydration is necessary for our health and wellbeing and it will also maintain your urinary track clean.

2. Some studies declare that several ejaculations each week will assist you to prevent cancer of the prostate.

3. Eat steak moderately. It has been shown that consuming more than four meals of beef a week will heighten the risk of prostate diseases and cancer.

4. Maintain a suitable diet with cereals, vegetable and fruits to make certain sufficient intake of nutrients needed for prostate health.

The most important measure to look at to be sure a normal prostate is to choose regular prostate health screening. If you are forty years old and above, you need to go for prostate examination at least one time 12 months.

Mon, May 28, 2018 @ 1:37 AM

Add a New Comment


code
 

Comment Guidelines: No HTML is allowed. Off-topic or inappropriate comments will be edited or deleted. Thanks.