If you are using wamp and enabled openssl from icon tray and still you are getting this error then:

When you enable php_openssl through the WAMP UI, you enable it for Apache, not for the CLI

You need to modify C:\wamp\bin\php\php-5.4.3\php.ini.

vertically center image in div

Posted: April 16, 2014 in PHP

<!doctype html>
<html lang="en">
<head>
</head>
<body>
<style>
.cover{ float:left; margin: 10px;}
.box
{
height: 100px;
width: 100px;
text-align: center;
vertical-align: middle;
background:D6D6D6;
border: 1px solid grey;
display:table-cell;
}
.container
{
vertical-align: middle;
}
.container img
{
max-height: 100px;
max-width: 100px;
}
</style>
<div class="cover">
<div class="box">
<div class="container">
<img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRjWxCr7_t7KoK_WSe3UDeucvuaiyddKqk4FfqNOxUAyC0AbVRO" >
</div>
</div>
</div>
<div class="cover">
<div class="box">
<div class="container">
<img src="http://wallpaper.pickywallpapers.com/htc-hd7/preview/red-bull-logo.jpg" >
</div>
</div>
</div>
<div class="cover">
<div class="box">
<div class="container">
<img src="http://www.hdwpapers.com/thumbs/batman_logo_wallpaper_2-t2.jpg" >
</div>
</div>
</div>
<div class="cover">
<div class="box">
<div class="container">
<img src="http://wallpaper.pickywallpapers.com/lg-dare/preview/big-android-logo-on-a-blue-background.jpg" >
</div>
</div>
</div>
</body>
</html>


// Detect file input support
var isFileInputSupported = (function () {
// Handle devices which falsely report support
if (navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)) {
return false;
}
// Create test element
var el = document.createElement("input");
el.type = "file";
return !el.disabled;
})();

if (isFileInputSupported)
$('[name="myfile[]"]').trigger('click');
else
alert('This device does not support File upload.');

iphone image upload rotation php

Posted: April 4, 2014 in PHP
Tags:

When you browse mobile photos and upload it to server using php then many times you can face orientation issue. i.e. image rotates by 90 angle. Below PHP code will handle that.


// Input: $filePath : path to image file
// Output: If there is any orientation required then function will change that image accordingly
function setDeviceRotation($filePath)
{
$exif = exif_read_data($filePath);

//if there is orientation change
$exif_orient = isset($exif['Orientation']) ? $exif['Orientation'] : 0;
$rotateImage = 0;

//convert exif rotation to angles
if (6 == $exif_orient)
{
$rotateImage = 90;
$imageOrientation = 1;
}
elseif (3 == $exif_orient)
{
$rotateImage = 180;
$imageOrientation = 1;
}
elseif (8 == $exif_orient)
{
$rotateImage = 270;
$imageOrientation = 1;
}
//if the image is rotated
if ($rotateImage)
{
$rotateImage = -$rotateImage;
$info   = getimagesize($filePath);
$fileType = $info[2];
switch ($fileType)
{
case '2': //image/jpeg
$source = imagecreatefromjpeg($filePath);
$rotate = imagerotate($source, $rotateImage, 0);
imagejpeg($rotate,$filePath);
break;
case '3': //image/png
$source = imagecreatefrompng($filePath);
$rotate = imagerotate($source, $rotateImage, 0);
imagepng($rotate,$filePath);
break;
case '1':
$source = imagecreatefromgif($filePath);
$rotate = imagerotate($source, $rotateImage, 0);
imagegif($rotate,$filePath);
break;
default:
break;
}
}
// The image orientation is fixed, pass it back for further processing
return $file;
}

http://www.mydomain.com/abc2015

http://www.mydomain.com/event2015


RewriteEngine On

RewriteRule ^(.*)2015$ http://www.mydomain.com/redirect.php?year=2015&folder=$1 [R=301,L]

 

Redirect /myfolder https://www.google.co.in/#q=myfolder

Ignore folder in .htaccess file

Posted: February 13, 2014 in PHP

You can create .htaccess file with below code and add it in folder which you want to ignore:

RewriteEngine off

OR

RewriteCond %{REQUEST_URI} !^/?(ignore_me)/ [L]