Wednesday, October 30, 2013
Tuesday, October 22, 2013
Resize image using PHP
<?php
// Include the class
include("resize-class.php");
// 1) Initialise / load image
$resizeObj = new resize('sample.jpg');
// 2) Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage(200, 200, 'crop');
// 3) Save image
$resizeObj -> saveImage('sample-resized.jpg', 100);
?>
Thursday, October 17, 2013
Upload multiple image in PHP
<html>
<head>
<title>Multi Image Upload</title>
<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script type="text/javascript">
var i=1;
function fnaddimage(){
if(i<5){
$('#check').before('<div id="addimage"><div class="select-image"><input type="file" name="image[]"></div><input type="button" value="Remove" onclick="fnremoveimage(this)"></div></div>');
i++;
}
}
function fnremoveimage(intI){
$(intI).parent().remove();
i--;
}
</script>
<style>
.select-image{float:left}
</style>
</head>
<body>
<?php
if(!empty($_POST)){
for($i=0;$i<count($_FILES["image"]["name"]);$i++){
$fileData = pathinfo(basename($_FILES["image"]["name"][$i]));
if($fileData['extension']=='jpg' || $fileData['extension']=='png' || $fileData['extension']=='gif' || $fileData['extension']=='jpeg'){
$target_path = $_SERVER['DOCUMENT_ROOT'].'upload/'.$fileData['basename'];
move_uploaded_file($_FILES["image"]["tmp_name"][$i], $target_path);
}
else
{
echo "There was an error uploading the file {$_FILES['image']['name'][$i]}, please try again!<br />";
}
}
}
?>
<form enctype="multipart/form-data" action="multiimage.php" method="POST">
<div>
<div id="addimage">
<div class="select-image"><input type="file" name="image[]"></div>
<div class="btn-image">
<input type="button" value="Add" onclick="fnaddimage()">
</div>
</div>
<div id="check"></div>
<input type="submit" name="Upload" value="Upload">
</div>
</form>
</body>
</html>
Tuesday, October 8, 2013
Flash Player Timer
<html>
<head>
<title>Flash Timer</title>
</head>
<body>
<object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" height="180" id="main" width="176">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://beta.theonepoint.net/public/images/hquiz/main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<param name="FlashVars" value="sec=60&id=2" />
<embed src="http://beta.theonepoint.net/public/images/hquiz/main.swf"
width="176"
height="180"
autostart="false"
quality="high"
bgcolor="#ffffff"
FlashVars="sec=60&id=2"
name="main"
align="middle"
wmode="transparent"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
Wednesday, October 2, 2013
Get Days,Months,Years,Hours,Minutes and Seconds between Dates in PHP
<?php
// First Date
$exp_date = date("Y-m-d",strtotime('2013-09-24 16:20:00'));
//Second Date
$del_date = date("Y-m-d",strtotime('2013-09-30 11:54:47'));
$datetime1 = date_create($exp_date);
$datetime2 = date_create($del_date);
$interval = date_diff($datetime1, $datetime2);
//Display all parameters with value
print "<pre>";
print_r($interval);
?>
Subscribe to:
Posts (Atom)