Search code examples
phpconcrete5concrete5-8.x

Concrete5: An image could not be created from the given input


Using Concrete5 8.1, I am getting the error An image could not be created from the given input on every page.

I created a custom theme, custom Thumbnail sizes, and custom Page Types, most of the site content has been entered and everything was working well. In reviewing the site before it goes live, I noticed most of the images had been uploaded as fairly large images (2000-4000 pixels wide, nothing insanely huge, but large enough that I wanted to do something about it).

Based on the Concrete5 documentation, I added the following code:

  public function getThemeResponsiveImageMap() {
    return array(
      'timeline_gallery' => '0'
    );
  }

The timeline_gallery thumbnail has existed since the start of this project, so all images should have already had this thumbnail. But when I refreshed the page, I see the error: An image could not be created from the given input.

Google finds many entries for this error: potentially related to GD not being able to process SVG, PNG, or very large images, and the solution is to address the problem images within the File Manager. However, I cannot get to the File Manager - I cannot get to any page on the site, including any of the dashboard pages (all display the same error).

I then remove the 5 lines of code from above (the only code changes that have taken place over the past 24 hours) and save the page_theme.php, but I still see the same error on every page.

It would be great to be able to fix the image sizes, but at this point, I'd just like to clear the error and make the site work again. I have looked at the Apache log for any specifics on the error (no help, since the error doesn't show up), I have restarted Apache, and then rebooted the machine (all to no avail). With the code being the same as when the site was working earlier today (and all content editors have left, so no content changes have taken place), I'm guessing there might be a queue, either in the file system or database, of images to be resized and one of them is causing an issue... but it's just a guess.


Solution

  • You can clear the error by modifying the FileImageThumbnailPaths table.

    1. Find the table entry where isBuilt is 0.

      SELECT * FROM FileImageThumbnailPaths WHERE isBuilt = 0;
      
    2. In the results, change the entry isBuilt column to 1.

    If you have multiple entries to change, you can change them all at once.

    UPDATE FileImageThumbnailPaths SET isBuilt = 1 WHERE isBuilt = 0;
    

    Using phpMyAdmin:

    • select your concrete5 database
    • click the SQL tab in the top menu bar in the right pane
    • in the textarea, you can enter the SQL query

    Before making any changes to the database, please make a full backup of your database and site files.