Friday, January 30, 2015
upload and resize multiple images with one input using php
<?php
if(isset($_POST["btn"])){
extract($_POST);
$error=array();
$extension=array("jpeg","jpg","png","gif");
foreach($_FILES["uploadedfile"]["tmp_name"] as $key=>$tmp_name)
{
$time=mktime(date("h"),date("i"),date("s"),date("d"));
$tt=date("hisd",$time);
$target_path = "photo_gallery/".$tt;
$target_path = $target_path . basename( $_FILES["uploadedfile"]['name'][$key]);
$target_path2 = "photo_gallery/small/".$tt;
$target_path2 = $target_path2 . basename( $_FILES["uploadedfile"]['name'][$key]);
/* $pn="photo_gallery/".basename( $_FILES["uploadedfile"]['name']);*/
$pn="photo_gallery/".basename($_FILES["uploadedfile"]["name"][$key]);
$ch=strtolower(substr($pn, strrpos($pn,".")+1));
if($ch=="jpg" or $ch=="png" or $ch=="jpeg" or $ch=="gif"){
/* $uploadedfile = $_FILES['uploadedfile']['tmp_name'];*/
$uploadedfile = $_FILES["uploadedfile"]["tmp_name"][$key];
if (!empty($uploadedfile)){
$info = getimagesize($uploadedfile);
if($ch=="jpg" || $ch=="jpeg" )
{
if ($info['mime'] == 'image/jpeg')
$src = imagecreatefromjpeg($uploadedfile);
}
else if($ch=="png")
{
if($info['mime'] == 'image/png')
$src = imagecreatefrompng($uploadedfile);
}
else
{
if($info['mime'] == 'image/gif')
$src = imagecreatefromgif($uploadedfile);
}
list($width,$height)=getimagesize($uploadedfile);
$newwidth=$width;
$newheight=$height;
$newwidth2=312;
$newheight2=($height/$width)*$newwidth2;
$tmp=imagecreatetruecolor($newwidth,$newheight);
$tmp2=imagecreatetruecolor($newwidth2,$newheight2);
if(!empty($src)){
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
imagecopyresampled($tmp2,$src,0,0,0,0,$newwidth2,$newheight2,$width,$height);
$filename = "photo_gallery/".$tt. $_FILES["uploadedfile"]["name"][$key];
$filename2 = "photo_gallery/small/".$tt. $_FILES["uploadedfile"]["name"][$key];
imagejpeg($tmp,$filename,100);
imagejpeg($tmp2,$filename2,100);
imagedestroy($src);
imagedestroy($tmp);
imagedestroy($tmp2);
}
}
}
}
}
?>
<form enctype=multipart/form-data method='POST'>
<input type="file" name="uploadedfile[]" multiple accept="image/*"/>
<input type="submit" name="btn" value="upload">
</form>
Thursday, January 29, 2015
Customize Size of Date time picker in jquery 1.9.1 for responsive web page
@media (max-width: 767px) {
.date-form { margin: 10px; }
label.control-label span { cursor: pointer; }
.date-form { margin: 10px; }
label.control-label span { cursor: pointer; }
#ui-datepicker-div{
width:228px;
z-index:1000 !important
}
div.ui-datepicker{
font-size:14px;
}
}
width:228px;
z-index:1000 !important
}
div.ui-datepicker{
font-size:14px;
}
}
Wednesday, January 28, 2015
Eating peanut is essencial for heart!
Researchers America and China have found that instead of sweet foods, and foods rich in fat, sugar, peanuts, cashews andBrazilian soy can help reduce the risk of heart disease has almost 1/3 or about 20 percent. However, the risk of death other diseases can be reduced about 17 percent.
Peanuts, cashews and peanuts Brazil was found to be rich in vitamins, minerals, fatty acids and other nutrients. When all this together it creates an effective force in lowering cholesterol, fat and cholesterol reduction inflammation in the body.
Examining the data of the study, 18 patients with diabetes type 2 -2 1 thousand thousands and tens of thousands of heart patients 1 5 billion from university research, science and technology, Wuhan, China, and Howard University, USA, found that those who eating peanuts or cashew Brazilian beans once a day to see that the risk of heart disease dropped between 28 to 29 percent while the risk to die from other diseases fell by about 17 percent.
However, they saw no difference in diabetes between soy intake and you do not eat. Slight reduction in the risk for stroke.
Specified in the report of its findings, the researchers said: 'The findings showed the support on the fact that the inclusion of peanut cashew nuts or beans, Brazil, etc. into the daily diet is provide protection against a number of chronic diseases.
Tuesday, January 27, 2015
Health benefit of Avocado
Avocados often have many health benefits, such as a healthier heart, better skin, helping you lose weight and treating or avoiding serious health trouble like diabetes and arthritis.
Base
on consideration form, stable a good cold-pressed avocado oil usage
like this, especially as a replacement to the ruin vegetable oils most
people use in cooking, can be especially beneficial for you. UK readers
can find the fair trade and organic avocado oil.
There
are a lot of healthy nutrients in avocado, but we expect that benefits
are more than enough reason to look more closely at one of
nature’s healthiest foods the next time you’re out shopping.
Friday, January 23, 2015
jquery datetime picker
$(function() {
$('.date-picker').each(function(){
$(this).datepicker({
showWeek: true,
firstDay: 1
});
});
});
$('.date-picker').each(function(){
$(this).datepicker({
showWeek: true,
firstDay: 1
});
});
});
Thursday, January 22, 2015
VLC for Windows Phone enters beta, for old-school video viewer
At long last, play-everything video app VLC has arrived on Windows Phone in beta form. The interesting question is who will use it.
The VLC for Windows Phone beta must get from downloading manually and sideloaded to your phone. The VideoLan team that designed the app warned on Twitter that the beta is pretty rough, and includes bugs like its inability to play audio in the background. Still, it apparently works, at least somewhat. You’ll need Windows Phone 8.1 to run it.
So what’s it good for? VLC’s claim to fame is that if you had any snippets of video lying around your hard drive, from old grainy pieces of footage to full movies from shady sources, it should be able to play them.
Why this matters: use of vlc case is shrinking, but it hasn't gone away. More and more, consumers are turning to streaming sources like Netflix or YouTube to watch movies, especially when there’s Wi-Fi available. On crowded trains that dip beneath the ground, however, recorded video can be just the thing—provided you have the available storage space, as well.
Wednesday, January 21, 2015
It is not good to drink long-time stocked boiled water.
Everyone always think that boiled water is good but boiled water is
harmful to our health if it is stocked long time. Based on the
specialist, water boiled with 100 degree can damage the bad baterial
only in 2 hours after its boil, baterial will be increased. And after 24
hours, Baterials will grow more and more.

The
specialist have told that at 60 degree, the many baterials died in 10
minutes or 100 degree in 5 minutes. And baterials live every where such
as in space, ground and water or items around us. That why you need to
clean fruits or kitchen tools with hot water so that the baterials die.
More
over, when people drink boiled water that stocked long time, they can
be hurt by nitrate acid that is created by boiled water. one day the
water can product nitrate acid 0.004 mg and it will increase up to 0.011
mg within 3 days. so in 20 days, nitrate acide will be 0.73 mg.
Therefore, you must not drink boiled water that kept more than 3 days.
Doctor says that boiled water that kept long time, may lose much oxigen
and water become the water with bad baterial. In case you keep boiled
water in bottle that you drink directly with your mouth, you should
throw it away when it remains in few days so that infection of bad
baterial to you is low.
Tuesday, January 13, 2015
Sunday, January 11, 2015
Monday, January 5, 2015
avoid black background of resize image of png extention
if($info['mime'] == 'image/png'){
imagefilledrectangle($tmp, 0, 0, $newwidth, $newheight, imagecolorallocate($tmp, 255, 255, 255));
imagefilledrectangle($tmp2, 0, 0, $newwidth2, $newheight2, imagecolorallocate($tmp2, 255, 255, 255));
}
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
imagefilledrectangle($tmp, 0, 0, $newwidth, $newheight, imagecolorallocate($tmp, 255, 255, 255));
imagefilledrectangle($tmp2, 0, 0, $newwidth2, $newheight2, imagecolorallocate($tmp2, 255, 255, 255));
}
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
Friday, January 2, 2015
nth-of-type(2) and nth-child(2)
1
If you click on me, I will disappear.1
2
Click me away!
Click me too!
----------------------------
Child-selector
http://api.jquery.com/child-selector/
Subscribe to:
Posts (Atom)