Skip to content
This repository was archived by the owner on Mar 1, 2018. It is now read-only.
This repository was archived by the owner on Mar 1, 2018. It is now read-only.

Unable to save thumb if project is installed in subdirectory of web root #8

Description

@eoma

I have to say, this is a brilliant plugin.

After struggling a bit with why the plugin wouldn't save the generated thumbs, I found out it all lies in the sfRawFileCache.

When the method sfRawFileCache::setCacheKey calls $context->getController()->genUrl($internalUri, false), it will use the full public path, invalidating the internal path when the project is not installed in the document root.

I therefore propose to modify sfRawFileCache::setCacheKey() to look something like:

class sfRawFileCache extends sfFileCache
{
...
  static public function setCacheKey($internalUri, $hostName = '', $vary = '', $contextualPrefix = '', $sfViewCacheManager)
  {
    $context = sfContext::getInstance();
    $internalUri = str_replace('sfImageTransformator/index', '@'.$context->getRouting()->getCurrentRouteName(), $internalUri);

    return str_replace($context->getRequest()->getRelativeUrlRoot(), '', $context->getController()->genUrl($internalUri, false));
  }
...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions