Code Snippets

PHP: How to fix Image rotation issue in img tag because of EXIF

Photos captured by some smartphones especially iPhones are automatically rotated when we use it in <img> tag which is mostly not acceptable as we don’t need such unwanted rotation. This happens because of EXIF Data stored in that image. But we can easily fix it using PHP by following these steps:

Or you can also fix it with just one line […]

How to Change Bootstrap Carousel Slide Speed

The speed cannot be controlled by the API. Though you can modify CSS that is in charge of that. find in the bootstrap.css file:

and change 0.6s to the time you want. You also might want to edit time in the function call below:

.emulateTransitionEnd(2000)

at bootstrap.js in function Carousel.prototype.slide. That synchronize transition and prevent slide to disapear before transition ends.

Source: http://stackoverflow.com/questions/17332431/how-can-i-control-the-speed-that-bootstrap-carousel-slides-in-items/17332516#17332516 […]

How to lock screen orientation to portrait or landscape?

This article will show you how to lock screen orientation to one direction.
Environment Details:
– Phonegap Build – cli-5.2.0
– Device: iPhone S5 9.3.2

For locking orientation to portrait add following code into your config.xml:

For Landscape:

Source: https://github.com/phonegap/build/issues/263 […]

PHP: How to run / execute a script in the background forever through SSH ?

You can execute a php script in the background forever by using SSH through PHP but for that you have to make sure first that SSH2 extension is available.

PHP DOCS: http://www.php.net/manual/en/function.ssh2-exec.php

If you want to do same thing through SSH Terminal (PuTTY) then follow this tutorial:
SSH: how to run a PHP script in background forever in Linux (CentOS) ? […]

Cordova: How to download file and get download progress?

  […]

Cordova: How to check if a file exists or not?

Above code works for both files and directories.

For Full article with extended features visit Following:
Cordova Sample: Check for a file and download if it isn’t there

Click here for Complete Documentation of cordova.file plugin

  […]

Cordova: How to get list of all Files/Directories in a directory?

Tested in Android.

Click here for more details.

Another link Mobile File Explorer with PhoneGap/Cordova has examples. […]

Cordova: How to create directory?

For Documentation Visit: https://www.npmjs.com/package/cordova-plugin-file#android-file-system-layout […]