Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SquareNetMedia's avatar

Spatie Media Pro

Ive upgraded to Spatie Media Pro so I could use the livewire component blades. I have followed the instruction of installation but I am getting the error Call to undefined function Spatie\Image\Drivers\Gd\imagecreatefromstring()

I'm not sure what its relating to, as the free version I had no errors.

0 likes
1 reply
LaryAI's avatar
Level 58

It seems like the error you're encountering is related to the GD library in PHP, which is used for image processing. The imagecreatefromstring() function is a part of the GD library, and the error message suggests that this function is not available in your current PHP installation.

Here are the steps you can take to resolve this issue:

  1. Ensure GD Library is Installed: First, make sure that the GD library is installed and enabled in your PHP environment. You can check this by creating a PHP file with the following content and navigating to it in your browser:

    <?php
    phpinfo();
    

    Look for the section on GD support. If it's not there, you need to install it.

  2. Install GD Library: If you're using a Linux distribution, you can install the GD library using the package manager. For example, on Ubuntu, you can use the following commands:

    sudo apt-get update
    sudo apt-get install php-gd
    

    After installing, you'll need to restart your web server:

    sudo service apache2 restart
    # or if you're using nginx
    sudo service nginx restart
    

    If you're using a different operating system or server setup, the commands might differ.

  3. Verify Installation: After installing the GD library and restarting your web server, check the phpinfo() output again to ensure that the GD section is now present.

  4. Update Your PHP Configuration: If GD is installed but not enabled, you may need to edit your php.ini file to enable it. Locate the php.ini file (its location can be found in the phpinfo() output), and make sure the following line is uncommented:

    extension=gd
    

    Save the changes and restart your web server.

  5. Clear Config Cache: If you're using Laravel, it's also a good idea to clear the configuration cache after making changes to your PHP environment:

    php artisan config:clear
    

After following these steps, try running your Livewire component with Spatie Media Library Pro again. If the issue persists, ensure that your PHP version is compatible with the version of Spatie Media Library Pro you're using, and check the library's documentation or support channels for any additional requirements or troubleshooting steps.

Please or to participate in this conversation.