Larupload
  • 🏁Getting Started
    • Introduction
    • Installation
    • Laravel Nova integration
    • Support Us
    • License
  • 🚀Basic Usage
    • Database Preparation
    • Model Preparation
    • Upload
  • ⚙️Advanced Usage
    • Concepts
    • Configuration
      • Disk
      • Local Disk
      • Mode
      • SecureIds
      • With Meta
      • Camel Case Response
      • Hide Table Columns
      • Naming Method
      • Lang
      • Image Processing Library
      • Generate Cover
      • Cover Style
      • Dominant Color
      • Dominant Color Quality
      • Keep Old Files
      • Preserve Files
      • Store Original File Name
      • Optimize Image
      • FFMpeg
        • FFMpeg Binaries
        • FFMpeg Threads
        • FFMpeg Capture Frame
        • FFMpeg Queue
        • FFMpeg Max Queue Number
        • FFMpeg Timeout
        • FFMPEG Log Channel
    • Attachment
      • Disk
      • With Meta
      • Naming Method
      • Lang
      • Image Processing Library
      • Generate Cover
      • Cover Style
      • Dominant Color
      • Dominant Color Quality
      • Keep Old Files
      • Preserve Files
      • Store Original File Name
      • SecureIds Method
      • Optimize Image
      • Media Styles
      • Complete Example
    • Migrations
      • Heavy Columns
      • Light Columns
      • Add Original File Name to Existing Tables
  • Upload
  • Delete
  • Cover
    • Upload Cover
    • Update Cover
    • Delete Cover
  • Download
    • Generate Download Link
      • Generate URL for particular style
      • Generate URL for all styles
    • Generate Download Response
  • Meta
  • Get Attachments
  • API Resources
  • Image Optimization
  • SecureIds
  • Queue FFMpeg Processes
    • Job Completion Event
    • FFMpeg Queue Relationships
  • 🧱Standalone Uploader
    • Introduction
    • Upload
    • Delete
    • Cover
      • Update Cover
      • Delete Cover
    • Customization
  • ⚪OTHER
    • Migration
Powered by GitBook
On this page
Edit on GitHub

Meta

The meta method in Larupload is used to retrieve meta information about an attachment. This method can provide various types of information, such as the originalName, size, type, mimeType, duration, width, height, and dominantColor of the uploaded file. The method takes an optional argument that specifies which specific piece of meta information is to be retrieved. If no argument is provided, the method returns all available meta information for the attachment.

For example, to retrieve the size of an attachment named "file", you can use the following code:

$size = $model->attachment('file')->meta('size');

Similarly, to retrieve the MIME type of the same attachment, you can use the following code:

$mime = $model->attachment('file')->meta('mime_type');

If you want to retrieve all available meta information for the attachment, you can simply call the meta method without any arguments, like this:

$meta = $model->attachment('file')->meta();
Output
{
    "name": "9e55cf595703eaa109025073caed65a4.jpg",
    "id": "1",
    "original_name": "image.jpg",
    "size": 35700,
    "type": "IMAGE",
    "mime_type": "image/jpeg",
    "width": 1077,
    "height": 791,
    "duration": null,
    "dominant_color": "#f4c00a",
    "format": "jpg",
    "cover": "9e55cf595703eaa109025073caed65a4.jpg"
  }

It's important to note that the type field returned by the meta object is based on the file extension, and not on the actual contents of the file.

Here are some more details about each type:

  • IMAGE: for files with extensions like jpg, png, gif, bmp, etc.

  • VIDEO: for files with extensions like mp4, avi, mov, wmv, etc.

  • AUDIO: for files with extensions like mp3, wav, ogg, etc.

  • DOCUMENT: for files with extensions like doc, docx, pdf, ppt, pptx, xls, xlsx, etc.

  • COMPRESSED: for files with extensions like zip, rar, 7z, etc.

  • FILE: for all other file types that don't fall into the above categories.

PreviousGenerate Download ResponseNextGet Attachments

Last updated 10 months ago