PHP

지각생 연습장
  • PHP 강좌 : 좋은 강좌, 글, 커리큘럼 등
Hello! ecddddk interesting ecddddk site! I'm really like it! Very, very ecddddk good!

Very nice site!

Hello! eecekbf interesting eecekbf site! I'm really like it! Very, very eecekbf good!

Very nice site!

목차

PHP로 HTTP인증하기

짤막 팁/소스

  • 다른 페이지로 바로 이동 (인덱스 파일 등에서)
     <? header("Location: 옮길위치"); ?>
  • 제로보드 : 썸네일 이미지 표시하기 - 큰 이미지가 업로드되면, 자동으로 일정 폭 기준으로 크기를 변경한 썸네일을 생성하고, 표시한다. 썸네일은 업로드한 이미지를 최초로 열어볼 때 만들어진다.
<?php
	list($image1_width, $image1_height) = getimagesize($data[file_name1]);
	//$image1_width = imagesx($data[file_name1]);
	if($image1_width && $image1_width > 580) $image1_width_new = 580;
	else $image1_width_new = $image1_width;
	//echo $data[file_name1]; echo $image1_width;
	$image1_height_new = round($image1_height * 580 / $image1_width);
	$thumb1 = thumb($id, $data[s_file_name1], 580, $image1_height_new); // x:y = newx: newy => newy = y*newx / x 
 
	$upload_image1 = str_replace("style=\"", "style=\"width: ${image1_width_new}px; ", $upload_image1);
	$upload_image1 = preg_replace("/src=\S+ /", "src=$thumb1 ", $upload_image1);
	if($data[file_name2]) {
		list($image2_width, $image2_height) = getimagesize($data[file_name2]);
 
		if($image2_width && $image2_width > 580) $image2_width_new = 580;
		else $image2_width_new = $image2_width;
 
		$image2_height_new = round($image2_height * 580 / $image2_width);
		$thumb2 = thumb($id, $data[s_file_name2], 580, $image2_height_new); 
		$upload_image2 = str_replace("style=\"", "style=\"width: ${image2_width_new}px; ", $upload_image2);
		$upload_image2 = preg_replace("/src=\S+ /", "src=$thumb2 ", $upload_image2);
	}
?>

전자상거래

애플리케이션

참고

개인 도구