Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • PHP Tutorial
  • PHP Exercises
  • PHP Array
  • PHP String
  • PHP Calendar
  • PHP Filesystem
  • PHP Math
  • PHP Programs
  • PHP Array Programs
  • PHP String Programs
  • PHP Interview Questions
  • PHP GMP
  • PHP IntlChar
  • PHP Image Processing
  • PHP DsSet
  • PHP DsMap
  • PHP Formatter
  • Web Technology
Open In App
Next Article:
PHP | Imagick clone() Function
Next article icon

PHP | Imagick current() Function

Last Updated : 25 Jul, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report

The Imagick::current() function is an inbuilt function in PHP which is used to return the reference of current Imagick object. This function does not create any copy but returns the same instance of Imagick.

Syntax:

Imagick Imagick::current( void )

Parameters: This function does not accepts any parameters.

Return Value: It returns the instance of Imagick object.

Program 1: This program is regarding the simple functioning of the current() method. It will create a variable with a new name pointing to the same instance and show the content of the old one with the help of the new.




<?php
  
// Create new Imagick object
$im = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-6.png');
  
// Use Imagick::current() function and
// initialized with Image 
$im1 = $im->current();
  
// Imagick instance returned in a new variable $im1
header("Content-type: image/png");
  
// Display image as output
echo $im1;
  
?>
 
 

Output:
Output

Program 2: It performs the blur operation on the image using the 2nd variable and the change will be reflected on the first one as both of them are pointing to the same instance.




<?php
   
// Create new Imagick object
$im = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-6.png');
   
// Use Imagick::current() function
$im1 = $im->current();
   
// Use Imagick::blurImage() function to blur the image
$im1->blurImage(5, 3);
  
header("Content-type: image/png");
   
// Display the image as
echo $im;
   
?>
 
 

Output:
Output 2

Reference: https://www.php.net/manual/en/imagick.current.php



Next Article
PHP | Imagick clone() Function
author
piyush25pv
Improve
Article Tags :
  • PHP
  • Web Technologies
  • PHP-function
  • PHP-Imagick

Similar Reads

  • PHP | Gmagick current() Function
    The Gmagick::current() function is an inbuilt function in PHP which is used to return the reference of the current Gmagick object. This function does not create any copy but returns the same instance of Gmagick. Syntax: Gmagick Gmagick::current( void ) Parameters: This function doesn’t accept any pa
    1 min read
  • PHP | Imagick clear() Function
    The Imagick::clear() function is an inbuilt function in PHP which is used to clear all resource allocated to an Imagick object. Syntax: bool Imagick::clear( void ) Parameters: This function does not accept any parameter. It just clears off the resources of the Imagick object which is used to call th
    2 min read
  • PHP | Imagick clone() Function
    The Imagick::clone() function is an inbuilt function in PHP which is used to create a copy of Imagick object. This function creates copy of the same instance, that means it will have same properties and any change in it will not reflect to the main object. Syntax: Imagick Imagick::clone( void ) Para
    1 min read
  • PHP | Imagick __construct() Function
    The Imagick::__construct() function is an Imagick class constructor which takes the image path or image URL as parameter to instantiate the Imagick object for a specific image or a set of images. Syntax: Imagick::__construct( $files ) Parameters: This function accepts single parameter $files which h
    1 min read
  • PHP | Imagick blurImage() function
    The Imagick::blurImage() function is an inbuilt function in PHP which is used to add blur filter to the image. This function returns True on success. Syntax: bool Imagick::blurImage( $radius, $sigma, $channel ) Parameters: This function accepts three parameters as mentioned above and described below
    1 min read
  • PHP | Imagick cropImage() Function
    The Imagick::cropImage() function is an inbuilt function in PHP which is used to extracts the region of the image.Syntax: int Imagick::cropImage( $width, $height, $x, $y ) Parameters: This function accept four parameters as mention above and describe below. $width: This parameter is used to specify
    2 min read
  • PHP | Imagick clutImage() Function
    The Imagick::clutImage() function is an inbuilt function in PHP which is used to replace the colors in the image. The second parameter of this function replaces the color in a specific channel. Syntax: bool Imagick::clutImage( $lookup_table, $channel = Imagick::CHANNEL_DEFAULT ) Parameters: This fun
    1 min read
  • PHP | ImagickDraw comment() Function
    The ImagickDraw::comment() function is an inbuilt function in PHP which is used to add a comment to a vector output stream. The comment is appended at the end of the output stream. Syntax: bool ImagickDraw::comment( string $comment ) Parameters: This function accept a single parameter $comment which
    2 min read
  • PHP | Imagick destroy() Function
    The Imagick::destroy() function is an inbuilt function in PHP which is used to destroy the Imagick object and free all the resources associated with it. You can't access your object content once it is destroyed. Syntax: bool Imagick::destroy( void ) Parameters: This function does not accept any para
    1 min read
  • PHP | Imagick commentImage() Function
    The Imagick::commentImage() function is an inbuilt function in PHP which is used to add the comment in an image. Syntax: bool Imagick::commentImage( $comment ) Parameters: This function accepts a single parameter $comment which is used to hold the comment. Return Value: This function returns True on
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences