1

Can I get anyone to confirm the thumbs for assets used in CP are stored under craft/storage/runtime/assets/thumbs/? Is there a way to define a custom folder for that?

It's Craft 2 btw.

1 Answer 1

2

As you can see here

runtime/ – Pretty much everything in here is there for caching and logging purposes. Nothing that Craft couldn’t live without, if the folder happened to get deleted.

assets/ – Stores image thumbnails, resized file icons, and copies of images stored on remote asset sources, to save Craft an HTTP request when it needs the images to generate new thumbnails or transforms.

I can't think of a clean way to do this without changing too much and having much effort. The function, that returns the path is

/**
 * Returns the path to the craft/storage/runtime/assets/thumbs/ folder.
 *
 * @return string The path to the craft/storage/runtime/assets/thumbs/ folder.
 */
public function getAssetsThumbsPath()
{
    $path = $this->getAssetsPath().'thumbs/';
    IOHelper::ensureFolderExists($path);
    return $path;
}

/**
 * Returns the path to the craft/storage/runtime/assets/ folder.
 *
 * @return string The path to the craft/storage/runtime/assets/ folder.
 */
public function getAssetsPath()
{
    $path = $this->getRuntimePath().'assets/';
    IOHelper::ensureFolderExists($path);
    return $path;
}

/**
 * Returns the path to the craft/storage/runtime/ folder.
 *
 * @return string The path to the craft/storage/runtime/ folder.
 */
public function getRuntimePath()
{
    $path = $this->getStoragePath().'runtime/';
    IOHelper::ensureFolderExists($path);

    if (!IOHelper::fileExists($path.'.gitignore'))
    {
        IOHelper::writeToFile($path.'.gitignore', "*\n!.gitignore\n\n", true);
    }

    return $path;
}

 /**
 * Returns the path to the craft/storage/ folder.
 *
 * @return string The path to the craft/storage/ folder.
 */
public function getStoragePath()
{
    return CRAFT_STORAGE_PATH;
}

Thus you can change the CRAFT_STORAGE_PATH but everything in there is pretty much hard coded

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.