'HTML'에 해당되는 글 7건

  1. 2010.07.02 PHP 이미지 crop
  2. 2010.07.02 PHP 파일업로드 1
  3. 2010.06.30 웹표준교과서
  4. 2009.11.17 [html]테이블의 올바른 사용법
  5. 2009.08.20 hover를 위한 li태그와 a태그.
Server-Side/PHP2010. 7. 2. 00:52
<iframe name="cropFrame" width="60" height="50" scrolling="no" style="display:none;"></iframe>
<form action="crop.php" method="post" target="cropFrame">
    <input id="imageSrc" type="hidden" name="imageSrc" value="" />
    <input id="x" type="hidden" name="x" value="0" />
    <input id="y" type="hidden" name="y" value="0" />
    <input id="w" type="hidden" name="w" value="450" />
    <input id="h" type="hidden" name="h" value="200" />
    <input type="submit" value="crop" />
</form>

----------------------------------------------------------------------

<?php
    require_once './FirePHPCore/FirePHP.class.php';
    $firephp = FirePHP::getInstance(true);

    //$firephp->log($_POST['imageSrc']);
    
    $imageSrc = $_POST['imageSrc'];
    $x = $_POST['x'];
    $y = $_POST['y'];
    $w = $_POST['w'];  // 높이
    $h = $_POST['h'];   // 길이

    $target_w = 450;
    $target_h = 200;
    $jpeg_quality = 90;
    $src = substr($imageSrc, 2);
    $img_r = imagecreatefromjpeg($src);
    $dst_r = ImageCreateTrueColor($w, $h);

    imagecopyresampled(
        $dst_r,
        $img_r,
        0, 0, $x, $y,
        $target_w, $target_h, $w, $h
    );

    $output_filename = './pic/test.jpg';

    header('Content-type: image/jpeg');
    imagejpeg($dst_r, $output_filename, $jpeg_quality);
?>

imagecreatefromjpeg($src);
 - 해당 경로의 파일을 jpeg 이미지로 생성함

ImageCreateTrueColor($w, $h);
 - 파라미터로 받은 넓이와 높이의 크기만한 검정색 이미지를 생성함

imagecopyresampled(
    $dst_r, // 타겟 이미지
    $img_r,  // 복사할 이미지
    0,         // 타겟 이미지의 x좌표
    0,         // 타겟 이미지의 y좌표
    $x,       // 원본 이미지의 x좌표
    $y,       // 원본 이미지의 y좌표
    $target_w, // 타겟 이미지의 넓이
    $target_h,  // 타겟 이미지의 높이
    $w,      // 원본 이미지의 넓이
    $h        // 원본 이미지의 높이
);
 - 이미지의 크기를 변경해서 복사함
 - 이미지의 x, y 좌표는 좌상단 모서리에서 시작함

'Server-Side > PHP' 카테고리의 다른 글

FirePHP 사용법  (0) 2010.07.20
post raw data  (0) 2010.07.20
PHP 파일업로드  (1) 2010.07.02
[Code Igniter] layout 적용하기  (0) 2010.04.23
PHP 시간함수( strtotime, time(), date() )  (0) 2010.03.25
Posted by 준피
Server-Side/PHP2010. 7. 2. 00:48
<iframe name="uploadFrame" width="60" height="50" scrolling="no" style="display:none;"></iframe>
<form action="upload.php" method="post" enctype="multipart/form-data" target="uploadFrame"/>
    <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
    <label for="userfile">Upload a file:</label>
    <input type="file" name="userfile" id="userfile" />
    <input type="submit" value="Send File" />
</form>

---------------------------------------------------------------------

<?php
file_exists($filepath);
 - 파일경로를 파라미터로 넘겨주고 존재 여부를 Boolean으로 받음

 move_uploaded_file($_FILES['userfile']['tmp_name'], $path);
 - 파일을 해당 경로에 업로드함
?>



'Server-Side > PHP' 카테고리의 다른 글

FirePHP 사용법  (0) 2010.07.20
post raw data  (0) 2010.07.20
PHP 이미지 crop  (0) 2010.07.02
[Code Igniter] layout 적용하기  (0) 2010.04.23
PHP 시간함수( strtotime, time(), date() )  (0) 2010.03.25
Posted by 준피
즐길거리/책2010. 6. 30. 16:33


마크업을 공부할땐 항상 웹표준 교과서와 W3C 홈페이지를 이용한다. 뭐 앞으론 HTML5를 많이 볼테지만 그동안 많이 참고가 되었던 책이다. 이 책은 기본에 충실하면서도 왠만한 내용은 다 들어있다고 생각한다. 한권 가져다 놓으면 나름 든든한 책이다. 이 책 역시 처음부터 쭉 보기보단 필요한 부분을 찾아서 보는 용도가 좋다고 생각한다.
Posted by 준피
Client-Side/HTML, CSS2009. 11. 17. 19:21

http://hyeonseok.com/soojung/webstandards/2009/11/12/554.html

 

신현석님의 블로그에 자세한 설명이 나와있습니다.


'Client-Side > HTML, CSS' 카테고리의 다른 글

CSS3 embossing, highlight, gradient effect  (0) 2010.06.07
HTML5 meta Tag  (0) 2010.06.07
hover를 위한 li태그와 a태그.  (0) 2009.08.20
div(block element) vs span(inline element)  (0) 2009.03.24
name=contents readOnly  (0) 2006.11.27
Posted by 준피
Client-Side/HTML, CSS2009. 8. 20. 14:34
li태그 안에 a태그를 이용해서 html 코딩을 해야지만,
IE6등 하위버전 웹브라우저에서 hover기능을 활용할 수 있다.

여기서 id 값을 li태그에 주느냐, a태그에 주느냐에 따라 크로스 브라우징 시에
문제가 상당히 달라질 수 있다.

a태그에 주는 것이 IE에서나 FF에서나 용이하다고 생각한다.

<li><a href="#" id="id" class="class" onClick="return false;"> 내용</a></li>

'Client-Side > HTML, CSS' 카테고리의 다른 글

CSS3 embossing, highlight, gradient effect  (0) 2010.06.07
HTML5 meta Tag  (0) 2010.06.07
[html]테이블의 올바른 사용법  (0) 2009.11.17
div(block element) vs span(inline element)  (0) 2009.03.24
name=contents readOnly  (0) 2006.11.27
Posted by 준피