Jump to content
xisto Community

jagoan

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by jagoan


  1. strtotime() will convert nearly any date format into a timestamp which can be used to build a date with the date() function.

    $timestamp = strtotime("Wed, 02 Aug 2006 03:59:10 -0700");$newdate = date("Y-m-d", $timestamp);echo $newdate;

    or you can use this function.. :)
    <?phpfunction tanggal($x) {	$x = explode(" ",$x);	switch ($x[2]) {		case "Jan":			$bln = "01";		break;		case "Feb":			$bln = "02";		break;		case "Mar":			$bln = "03";		break;		case "Apr":			$bln = "04";		break;		case "May":			$bln = "05";		break;		case "Jun":			$bln = "06";		break;		case "Jul":			$bln = "07";		break;		case "Aug":			$bln = "08";		break;		case "Sep":			$bln = "09";		break;		case "Oct":			$bln = "10";		break;		case "Nov":			$bln = "11";		break;		case "Dec":			$bln = "12";		break;	}	$tanggal = "$x[3]-$bln-$x[1]";	return $tanggal;}$tgl = "Wed, 02 Aug 2006 03:59:10 -0700";echo $tgl."<br />";echo tanggal($tgl)."<p>";?>


  2. I would like to resize the image without saving it to file using the variables $get_width and $get_height as the width and height of the resized image.

     


    this is the script that I use to resize image..

     

    <?php$a = "images/".$_GET['src'];$b = $_GET['w'];$ext = explode(".",$_GET['src']);$ext = end($ext);$ext = strtolower($ext);if ($ext == "jpg") { header ("Content-type: image/jpeg"); }else if ($ext == "gif") { header ("Content-type: image/gif"); }else if ($ext == "png") { header ("Content-type: image/png"); }if ($ext == "jpg") { $img_src=imagecreatefromjpeg($a); }else if ($ext == "gif") { $img_src=imagecreatefromgif($a); }else if ($ext == "png") { $img_src=imagecreatefrompng($a); }$size = getimagesize($a);if ($b >= $size[0]) $b = $size[0];$c = round($b * $size[1] / $size[0]);$img_dst=imagecreatetruecolor($b,$c);imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $b, $c, $size[0], $size[1]);if ($ext == "jpg") { imagejpeg($img_dst, "", 100); }else if ($ext == "gif") { imagegif($img_dst); }else if ($ext == "png") { imagepng($img_dst); }imagedestroy($img_dst);?>

    using my script, the image will show with ?src=image_name&w=image_width

    the images are store in /images directory..

     

    this is the example:

    real image

    resized image

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.