라이브러리

[PHP] Gmagick::setfilename - 이미지를 읽거나 쓰기 전에 파일 이름을 설정합니다.




Gmagick::setfilename


Gmagick::setfilename은 Gmagick 클래스의 메소드 중 하나로, 이미지를 저장할 파일 이름을 설정하는 역할을 합니다. 이 메소드는 Gmagick 객체를 사용하여 이미지를 생성하거나 편집한 후, 저장할 파일 이름을 지정하는 데 사용됩니다.

사용 방법


Gmagick::setfilename 메소드는 다음과 같이 사용할 수 있습니다.

#hostingforum.kr
php

$gmagick = new Gmagick();

$gmagick->read('image.jpg');

$gmagick->resizeImage(100, 100, Gmagick::FILTER_LANCZOS, 1);

$gmagick->setfilename('output.jpg');

$gmagick->write('output.jpg');



예제


# 예제 1: 이미지 크기 조절 후 저장


#hostingforum.kr
php

$gmagick = new Gmagick();

$gmagick->read('image.jpg');

$gmagick->resizeImage(100, 100, Gmagick::FILTER_LANCZOS, 1);

$gmagick->setfilename('output.jpg');

$gmagick->write('output.jpg');



# 예제 2: 이미지 회전 후 저장


#hostingforum.kr
php

$gmagick = new Gmagick();

$gmagick->read('image.jpg');

$gmagick->rotateImage(Gmagick::ROTATE_90);

$gmagick->setfilename('output.jpg');

$gmagick->write('output.jpg');



# 예제 3: 이미지 필터링 후 저장


#hostingforum.kr
php

$gmagick = new Gmagick();

$gmagick->read('image.jpg');

$gmagick->filterImage(Gmagick::FILTER_GAUSSIAN_BLUR);

$gmagick->setfilename('output.jpg');

$gmagick->write('output.jpg');



참고


* Gmagick 클래스는 Imagick 클래스의 대체 클래스로, PHP에서 사용할 수 있습니다.
* Gmagick::setfilename 메소드는 이미지를 저장할 파일 이름을 설정하는 데 사용됩니다.
* Gmagick::write 메소드는 이미지를 파일로 저장하는 데 사용됩니다.
* Gmagick 클래스는 다양한 이미지 처리 기능을 제공하며, 이미지 크기 조절, 회전, 필터링, 등 다양한 기능을 제공합니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 521 페이지

검색

게시물 검색