spatie/laravel-medialibrary
Attach files to Eloquent models with an easy API. Upload from disk or request, store media across multiple filesystems (local/S3), and generate image/PDF conversions and manipulations using Laravel’s Filesystem.
getAvailableTemporaryUrl method (#3919)Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.19.0...11.20.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.18.2...11.19.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.18.1...11.18.2
registerAllMediaConversions() — the ?Media $media = null parameter that was added to the HasMedia interface in v11.18.0 has been removed, as it broke userland code that overrides the method without the parameter. The PHPStan error is now handled via the baseline instead. Fixes #3915.Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.10...11.18.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.8...11.17.9
getAvailablePathRelativeToRoot() method by @adriaanzon in https://github.com/spatie/laravel-medialibrary/pull/3877Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.9...11.17.10
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.7...11.17.8
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.6...11.17.7
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.5...11.17.6
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.4...11.17.5
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.3...11.17.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.2...11.17.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.1...11.17.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.17.0...11.17.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.14.0...11.17.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.15.0...11.16.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.14.0...11.15.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.13.0...11.14.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.9...11.13.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.8...11.12.9
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.7...11.12.8
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.6...11.12.7
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.5...11.12.6
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.4...11.12.5
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.3...11.12.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.2...11.12.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.1...11.12.2
alt attribute to responsive image components by @A909M in https://github.com/spatie/laravel-medialibrary/pull/3765Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.12.0...11.12.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.11.1...11.12.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.11.0...11.11.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.10.1...11.11.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.10.0...11.10.1
storeConversionsOnDisk() function by @djl997 in https://github.com/spatie/laravel-medialibrary/pull/3722Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.9.2...11.10.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.9.1...11.9.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.9.0...11.9.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.8.3...11.9.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.8.2...11.8.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.8.1...11.8.2
FileAdder.php by @rmdavi in https://github.com/spatie/laravel-medialibrary/pull/3681Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.8.0...11.8.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.7.6...11.8.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.7.5...11.7.6
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.7.4...11.7.5
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.7.3...11.7.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.7.2...11.7.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.7.1...11.7.2
moves_media_on_update doesn't work on S3 by @cameronbatty in https://github.com/spatie/laravel-medialibrary/pull/3647Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.7.0...11.7.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.6.1...11.7.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.6.0...11.6.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.5.4...11.6.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.5.3...11.5.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.5.2...11.5.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.5.1...11.5.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.5.0...11.5.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.8...11.5.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.7...11.4.8
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.6...11.4.7
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.5...11.4.6
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.4...11.4.5
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.3...11.4.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.2...11.4.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.1...11.4.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.4.0...11.4.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.3.1...11.4.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.3.0...11.3.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.2.0...11.3.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.1.2...11.2.0
Updated docs.
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.1.0...11.1.1
Fit enum by @bomshteyn in https://github.com/spatie/laravel-medialibrary/pull/3509Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.0.5...11.1.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.0.4...11.0.5
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.0.3...11.0.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.0.2...11.0.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.0.1...11.0.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/11.0.0...11.0.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.15.0...11.0.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.14.0...10.15.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.13.2...10.14.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.13.1...10.13.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.13.0...10.13.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.12.2...10.13.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.12.1...10.12.2
FileAdder@setFileSize() by @cosmastech in https://github.com/spatie/laravel-medialibrary/pull/3357Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.12.0...10.12.1
Filesystem@copyToMediaLibraryFromRemote() more extensible by @cosmastech in https://github.com/spatie/laravel-medialibrary/pull/3361Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.11.4...10.12.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.11.3...10.11.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.11.1...10.11.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.10.2...10.11.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.10.1...10.10.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.10.0...10.10.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.9.4...10.10.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.9.3...10.9.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.9.2...10.9.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.9.1...10.9.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.9.0...10.9.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.8.0...10.9.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.16...10.8.0
Allow any Laravel version up from 9.15
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.15...10.7.16
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.11...10.7.12
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.10...10.7.11
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.8...10.7.9
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.7...10.7.8
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.6...10.7.7
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.5...10.7.6
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.4...10.7.5
registerMediaConversionsUsingModelInstance property is set to true on the model by @tomcoonen in https://github.com/spatie/laravel-medialibrary/pull/3120Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.3...10.7.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.2...10.7.3
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.1...10.7.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/9.12.3...9.12.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.7.0...10.7.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.6.1...10.7.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.6.0...10.6.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.5.2...10.6.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.5.1...10.5.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.5.0...10.5.1
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.4.5...10.5.0
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.4.4...10.4.5
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.4.3...10.4.4
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.4.1...10.4.2
Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.4.0...10.4.1
Attachable objects by @freekmurze in https://github.com/spatie/laravel-medialibrary/pull/2963Full Changelog: https://github.com/spatie/laravel-medialibrary/compare/10.3.6...10.4.0
Move Larastan to dev deps
keepOriginalImageFormat() method to work with uppercase file extensions (#2527)Collection typehint to addMultipleMediaFromRequest (#2389)addMediaFromStream (#2363)null in the FileAdder 'order' setter (#2336)DiskDoesNotExist moved to it's own class (#2306)preservingOriginal (#2258)moves_media_on_update config valuegenerate_thumbnails_for_temporary_uploads config valueenable_temporary_uploads_session_affinity config valueoriginal_url to MediaCollection.generated_conversions on mediafile_namer key in the media-library config file (#2114)queue_conversions_by_default to config fileResponsiveImages based on condition (#2036)toMediaLibraryuseZipOptionsaddMediaFromStringaddFromStringSpatie\MediaLibrary\MediaCollections\Models\Collections\MediaCollectionfreads to fgets as per issue #812 (#1909)media to avoid failure caused by doctrine/inflictor now using medias as the plural/ in paths (#1854)addMediaFromUrlzip_filename_prefix in custom propertiesfloat for extractVideoFrameAtSecond (#1794)getFirstMedia() (#1781)uuid on media tablegetMedia('') will not return media from the default collection anymore (#1697).root and url properties on a configured diskshouldMatchBothExtensionsAndMimeTypes to Spatie\MediaLibrary\ImageGenerators\BaseGeneratorUrlGenerator interface now contains all required methods (#1656)loading attribute (#1667)conversion_file_namer key in the media-library config file (#1636)To learn how to upgrade, take a look in UPGRADING.md
image_driver config to be set via .env #1738withResponsiveImages() to custom collection (#1681)getFallbackMediaUrl and getFallbackMediaPathonlyKeepLatest on MediaCollectionFileAdder now is macroableCollectionHasBeenCleared will be called when using clearMediaCollectionExceptuseFallbackUrl and useFallbackPath to media collectionsjpeg in \Spatie\MediaLibrary\Conversion\Conversion::getResultExtension--only-missing for queued conversions (#1465)custom_headers property if explicitly set$copiedOriginalFile to the ConversionWillStart eventdo not use - broken
markAsConversionGeneratedmarkAsConversionGenerated: disable model events when saving extra properties in Media::updated eventids option of RegenerateCommandwebpaddMediaFromUrl would not work if the file contained a spacehasGeneratedConversionffprobe pathmaennchen/zipstream-php requirementsSoftDeletesmedialibrary.disk_name.Filesystem interface removed.Filesystem::renameFile(Media $media, string $oldFileName) to Filesystem::syncFileNames(Media $media)default_filesystem config key has been changed to disk_name.MediaCollectionsZipStreamResponsemove and copy methods on MediaHasMedia and HasMediaConversionsffmpeg_binaries renamed to ffmpeg_path, ffprobe_binaries renamed to ffprobe_pathwithManipulations to FileAdderroot config key for s3 disks.spatie/image depgetFirstTemporaryUrl methodgetFirstTemporaryUrlonly-missing and only options to the media-library:regenerate commandleague/flysystem and spatie/image when using --prefer-lowest option with composerResponsable interfacesanitizingFileNameConversionWillStart eventgetTemporaryUrl now uses disk name instead of disk drivergetTemporaryUrl method from UrlGenerator interfacegetTemporaryUrl method for media stored on S3registerMediaConversions has been changedmedia to publicdefaultFilesystem config option has been renamed to default_filesystemgetPath to S3UrlGeneratorMediaCannotBeDeleted exceptionaddMultipleMediaFromRequestaddMediaFromUrl and addMediaFromBase64addAllMediaFromRequest for file names in the request that contain an arraymediaIsPreloaded always returned truegetResultExtension for keepOriginalImageFormatclearMediaCollectionExcept methodkeepOriginalImageFormat manipulationtoMediaCollectionLocalUrlGenerator will now use the url property of disk when one has been setMediaRepository with a custom media modelcreateMultipleFromRequest and createAllFromRequest on FileAddertemporary_directory_path to configgetRemoteHeadersForFile()getPath when using S3this version is broken, do not use
getPath when using S3registerMediaConversionsUsingModelInstanceaddMediaFromBase64fullUrl methodgetFirstMediaUrl() always returning the url for the first conversiontoMediaLibraryOnCloudDiskmanipulations and custom_propertiesFileCannotBeAdded to their own exception classeslaravel-medialibrary to medialibrarytoCollection and toCollectionOnDisk and toMediaLibraryOnDiskspatie/laravel-glide by spatie/imageSpatie\MediaLibraryFilesystemInterface to Spatie\MediaLibrary\Filesystem\FilesystemwithCustomProperties, getNestedCustomProperty, setNestedCustomProperty, forgetNestedCustomProperty and hasNestedCustomPropertyKNOWN BUG: loading manipulations from the db doesn't work in certain edge cases, fix incoming soon
FilesystemInterfacer mode instead of r+setNewOrderhasNestedCustomProperty, getNestedCustomProperty, setNestedCustomProperty and forgetNestedCustomProperty to use dot notation with custom propertiesremoveCustomProperty to forgetCustomProperty (removeCustomProperty still exists but is marked as deprecated)s3addCustomHeaders functiongetUrl methodsImageGeneratorssrc format option when dealing with jpegsmime attribute on the Media modelremoveCustomProperty functionmedia-library:clean commandmedia-library:regenerate will continue regenerating files even if a primary media file is missingsrc option for the fm conversion parametershouldDeletePreservingMediaaddMediaFromRequest methodmorphMapdelete method of an Eloquent modelThis version contains a bug when using a custom UrlGenerator, please upgrade to 3.9.1
$media = $this->testModel->addMediaFromUrl($url)
clearMediaCollection is now chainablesetCustomProperty-method on MediawithProperties and withAttributes methodsHasMediaTrait::updateMedia now also updates custom properties. It also updates the order column starting at 1 instead of 0 (behaves the same as the sortable trait)getCustomProperty methodhasCustomProperty- and getCustomProperty-convenience-methodsx and y parameters in setRectangleregenerate-command now accepts an ids-optionmedia-library:clear commanddeletePreservingMedia-function that will delete the model but not remove the associated filesconfig_path helper in ServiceProvider to allow easier integration in LumenInvalidNewOrder-exceptionImportant node: there is a bug in this version that prevents the creation of derived files
CollectionHasBeenCleared, ConversionHasBeenCompleted, MediaHasBeenAddedCollectionClearedEvent, ConversionCompleteEvent, MediaAddedEventupdateMedia now returns updated mediaaddMedia by a fluent interfacegetMedia will now return all media regardless of collectionhasMedia will count all media regardless of collectionhasMediaWithoutConversions-interfaceThis version is a complete rewrite. Though there are lots of breaking changes most features of v1 are retained. Notable new functions:
Spatie\MediaLibrary\Models\Media::getHumanReadableFileSize()profile parameter in Media::getUrl() and MediaLibraryModelTrait::getUrl() is now optional. On null, it retrieves the original file's url.Media::getOriginalUrl() now returns the correct url.MediaLibraryModelInterfacegetImageProfileProperties()to interfaceHow can I help you explore Laravel packages today?