Purpose of /var/resource_config.json

Purpose of /var/resource_config.json

July 29, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Purpose of /var/resource_config.json

Unraveling the Mystery of /var/resource_config.json in Magento

As an experienced developer setting up multiple environments for an enterprise-level Magento project, you may encounter various configuration files scattered across the file system. One such file that often piques curiosity is /var/resource_config.json. In this post, we’ll explore its purpose, creation process, and best practices for managing it during your deployment workflow.

What is /var/resource_config.json?

The /var/resource_config.json file serves as a cache storage location for configuration data generated by Magento’s image processing and upload functionality. It primarily stores information related to the uploaded images processed through the admin panel’s flash uploader feature in Enterprise Edition.

This JSON file contains metadata about the images, including their original paths, thumbnails, watermarks applied, and other relevant details required for efficient image handling throughout the application.

Digging into the source: File creation process

To understand how this file is created and updated, let’s take a closer look at Magento’s core codebase. The primary component responsible for populating /var/resource_config.json is the Mage_Catalog_Model_Resource_Product class, specifically its save() method.

public function save()
{
    // ... (omitting unrelated code)

    $file = new Varien_Io_File();
    foreach ($this->getImages() as $productImage) {
        if (!empty($productImage['file'])) {
            $imageData = $this->_importImage($productImage);
            if (is_array($imageData)) {
                $this->saveImageInVarDir($imageData, $productId);
            }
        }
    }

    // ... (omitting unrelated code)
}

The save() method iterates through the product images and calls the private _importImage() and saveImageInVarDir() methods to process and store image metadata in the /var directory.

Best practices for managing /var/resource_config.json

Given the file’s purpose and cache nature, here are some best practices when setting up multiple environments:

  1. Exclude from version control: Since this file is generated dynamically based on the uploaded images in each environment, it’s recommended to exclude it from your version control system (e.g., .gitignore file) to avoid cluttering your repository with image metadata.

  2. Clean before deployments: As part of your deployment process, include a step to clean up the /var directory and recreate the necessary cache files using Magento’s built-in magneto setup:upgrade and magneto cache:clean commands.

  3. Manage environment-specific configuration: Ensure that any environment-specific image processing settings are properly configured in your configuration files (e.g., app/etc/local.xml). This includes watermarking, thumbnail dimensions, and other image-related settings.

Conclusion

The /var/resource_config.json file serves as a critical cache storage location for Magento’s image processing functionality. By understanding its purpose, creation process, and best practices for management, you can effectively handle this file during your local, development, staging, and production environment setup without compromising the application’s performance or data integrity.

Remember to exclude it from version control, clean up the /var directory before each deployment, and manage environment-specific configurations for optimal results. For more advanced Magento deployment strategies, consider exploring our comprehensive guides on Magento deployments available at LaravelCompany.

Happy coding!

Catalog Cache Admin Configuration

Our network