Thursday, November 20, 2025
HomeLanguagesPHP | ImagickDraw getClipPath() Function

PHP | ImagickDraw getClipPath() Function

The ImagickDraw::getClipPath() function is an inbuilt function in PHP which is used to get the current clipping path ID.

Syntax:

string ImagickDraw::getClipPath( void )

Parameters: This function doesn’t accept any parameter.

Return Value: This function returns an string value containing the clip path ID or false if no clip path exists.

Exceptions: This function throws ImagickException on error.

Below given programs illustrate the ImagickDraw::getClipPath() function in PHP:

Program 1:




<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Get clip path
echo $draw->getClipPath();
?>


Output:

//This will return empty string because default value is empty.

Program 2:




<?php
  
// Create a new ImagickDraw object
$draw = new ImagickDraw();
  
// Set the clipPath
$draw->setClipPath('sample_name');
  
// Get clip path
echo $draw->getClipPath();
?>


Output:

sample_name

Reference: https://www.php.net/manual/en/imagickdraw.getclippath.php

RELATED ARTICLES

Most Popular

Dominic
32405 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6779 POSTS0 COMMENTS
Nicole Veronica
11927 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11995 POSTS0 COMMENTS
Shaida Kate Naidoo
6906 POSTS0 COMMENTS
Ted Musemwa
7163 POSTS0 COMMENTS
Thapelo Manthata
6862 POSTS0 COMMENTS
Umr Jansen
6846 POSTS0 COMMENTS