Upgrade Guide
Upgrade from Intervention Image 3.x to 4.x
3.8M Downloads / Month
Open Source MIT License
3.8M Downloads / Month
Open Source MIT License
Learn how to migrate from Intervention Image version 3 to version 4. See what new features are available and what changes have been made in the update.
The revised image decoding interace introduces a more transparent approach to handling image sources. Allowing image sources to be addressed directly instead of relying on a single universal method.
Read more about decoding methods
At the same time, error and exception messages have been refined to provide clear, immediate insight into what went wrong. These improvements include a restructured exception system with a well-defined hierarchy that makes handling exceptions easier.
Intervention\Image\Color to create and parse more easilyNamedColor::class for css color names.ColorInterface::withTransparency(), ColorInterface::withBrightness(), ColorInterface::withSaturation and ColorInterface::withInversion()DriverInterface::version() to check internal version of driverIt is very likely that you will need to make these adjustments when you update to version 4.
ImageManagerInterface::animate() is replaced by universal ImageManagerInterface::createImage()ImageManagerInterface::read() is now handled by ImageManagerInterface::decode*()ImageManagerInterface::withDriver() is now handled by Image::usingDriver()ImageInterface::toJpeg() and ImageInterface::toJpg() are now handled by ImageInterface::encodeUsingFormat()ImageInterface::toPng() is now handled by ImageInterface::encodeUsingFormat()ImageInterface::toGif() is now handled by ImageInterface::encodeUsingFormat()ImageInterface::toJp2() and ImageInterface::toJpeg2000() are replaced by ImageInterface::encodeUsingFormat()ImageInterface::toWebp() is replaced by ImageInterface::encodeUsingFormat()ImageInterface::toBitmap() and ImageInterface::toBmp() are replaced by ImageInterface::encodeUsingFormat()ImageInterface::toAvif() is replaced by ImageInterface::encodeUsingFormat()ImageInterface::toHeic() is replaced by ImageInterface::encodeUsingFormat()ImageInterface::toTiff() and ImageInterface::toTif() are replaced by ImageInterface::encodeUsingFormat()ImageInterface::pickColor() was renamed to ImageInterface::colorAt() and signature has changed, argument $frame_key is know $frameImageInterface::pickColors() was renamed to ImageInterface::colorsAt()ImageInterface::pad() was renamed to ImageInterface::containDown() with different signatureImageInterface::place() was renamed to ImageInterface::insert() with a different signature. offset_x was renamed to x and offset_y was renamed to y and updated argument orderImageInterface::drawRectangle(), ImageInterface::drawLine(), ImageInterface::drawEllipse(), ImageInterface::drawCircle(), ImageInterface::drawPolygon() and ImageInterface::drawBezier() have changedImageInterface::save() only processes known image file extensionsEncodedImageInterface::toDataUri() now returns DataUriInterface::class instead of `string“FontInterface::filename() is replaced by FontInterface::filepath()FontInterface::hasFilename() is replaced by FontInterface::hasFile()FontInterface::setFilename() is replaced by FontInterface::setFilepath()ColorInterface::convertTo() was renamed to ColorInterface::toColorspace()Config::class option blendingColor was renamed to backgroundColorImageInterface::rotate() rotates clockwise by default.ImageInterface::blendTransparency() was renamed to ImageInterface::fillTransparentAreas() with a different signature allowing (semi) transparent colorsImageInterface::setBlendingColor() was renamed to ImageInterface::setBackgroundColor()ImageInterface::blendingColor() was renamed to ImageInterface::backgroundColor()It is possible that you will need to make these adjustments when updating to version 4 if you have delved deeper into the functions.
ColorInterface::toArray() use ColorInterface::channels() and map to desired formatColorInterface::normalize() use ColorInterface::channels() and map to desired formatbackground to null in ImageInterface::rotate()background to null in ImageInterface::resizeCanvas()background to null in ImageInterface::resizeCanvasRelative()background to null in ImageInterface::contain()background to null in ImageInterface::containDown() former ImageInterface::pad()background to null in ImageInterface::crop()ImageInterface::crop() changed from offset_x to x and offset_y to y$per_unit has change to $unit with different signature in Resolution::classDrawableFactoryInterface::init() is replaced by DrawableFactoryInterface::create()DrawableFactoryInterface::create() is replaced by DrawableFactoryInterface::drawable()DriverInterface::handleInput() is replaced by DriverInterface::handleImageInput(), DriverInterface::handleColorInput()CollectionInterface::empty() was renamed to CollectionInterface::clear()FontFactory::valign() was replaced with FontInterface::align()FontInterface::valignment() was renamed to FontInterface::verticalAlignment()FontInterface::setValignment() was renamed to FontInterface::setVerticalAlignment()FontInterface::alignment() was renamed to FontInterface::horizontalAlignment()FontInterface::setAlignment() was renamed to FontInterface::setHorizontalAlignment()ImageInterface::greyscale() was renamed to ImageInterface::grayscale()ColorInterface::isGreyscale() was renamed to ColorInterface::isGrayscale()__construct() or create() methods of colors are now defined as float values between 0 and 1FrameInterface::dispose() was rename to FrameInterface::disposalMethod()FrameInterface::setDispose() was renamed to FrameInterface::setDisposalMethod()ImageManagerInterface::driver() was removed but you can use the public $driver property.FileInterface::toFilePointer() was renamed to FileInterface::toStream()You will probably only need to make these adjustments when updating to version 4 if you use the API extensively and have written your own drivers or modifiers, for example.
BlendTransparencyModifer::class was renamed to FillTransparentAreasModifier::classProfileInterface::class requires implementation of ::fromPath()DriverInterface::class requires implementation of __construct()DriverInterface::class requires implementation of createCore()DriverInterface::specialize() with DriverInterface::specializeModifier(), DriverInterface::specializeAnalyzer(), DriverInterface::specializeDecoder() and DriverInterface::specializeEncoder()DriverInterface::handleColorInput() has null as defaultFrameInterface::__construct() has changed, argument $offset_left is know $offsetLeft and $offset_top is now $offsetTopPixelColorAnalyzer::__construct() has changed, argument $frame_key is know $frameColorChannelInterface::max() and ColorChannelInterface::min() are now staticColorChannelInterface::toInt() was removed use ColorChannelInterface::value() insteadColorChannelInterface::colorFromNormalized() requires now a static implementationColorChannelInterface::normalize() was renamed to ColorChannelInterface::normalizedValue()CoreInterface::class now requires implementation of CoreInterface::meta()RectangleResizer::class was renamed to Resizer::classGreyscaleModifier::class was renamed to GrayscaleModifier::classDrawableFactoryInterface::__invoke() was removed, use DrawableFactoryInterface::build() or DrawableFactoryInterface::drawable()FontFactory::__invoke() was removed, use FontFactory::build() or FontFactory::font()AnimationFactory::__invoke() was removed, use AnimationFactory::build() or AnimationFactory::animation()InputHandler::withDecoders() was renamed to InputHandler::usingDecoders()ColorInterface::class now requires to implement ColorInterface::withTransparency()ColorInterface::class now requires to implement ColorInterface::alpha()topLeftPoint() and bottomRightPoint() from Rectangle::classColorChannelInterface::__construct() from interfaceDriverInterface::createAnimation()SizeInterface::relativePositionTo() was renamed to SizeInterface::offsetTo()DrawableInterface requires the implementation of factory() and adjust().ColorProcessorInterface::colorToNative() was renamed to ColorProcessorInterface::export()ColorProcessorInterface::nativeToColor() was renamed to ColorProcessorInterface::import()