Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing cached asset path for dev mode #200

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ollietb
Copy link

@ollietb ollietb commented Aug 27, 2015

This is still not fixed in the latest commit 8ee4e5f although it was close...

The problem is that in dev mode the URL generated by the router->generate() contains "app_dev.php" so the URL can never be directly converted to a file path.

eg. the $cached file path is /var/www/site/app/../web/app_dev.php/media/cache/background/uploads/Big_dipper.png so the line
file_exists($cached) doesn't exist

This will affect any user of this bundle who uses app_dev.php in the URL of their dev environment (which I think is the majority) and the images will always be regenerated and never loaded from cache. On pages with a lot of generated images this was taking a long time to load.

This fix will make sure that the app_dev.php (or any other *.php files) are removed from the generated URL. It's not the most elegant solution but it will work for majority of people this affects.

This is still not fixed in the latest commit 8ee4e5f although it was close...

The problem is that in dev mode the URL generated by the `router->generate()` contains "app_dev.php" so the URL can never be directly converted to a file path.

eg. the `$cached` file path is `/var/www/site/app/../web/app_dev.php/media/cache/background/uploads/Big_dipper.png` so the line
`file_exists($cached)` doesn't exist

This will affect any user of this bundle who uses `app_dev.php` in the URL of their dev environment (which I think is the majority) and the images will always be regenerated and never loaded from cache. On pages with a lot of generated images this was taking a long time to load.

This fix will make sure that the app_dev.php (or any other *.php files) are removed from the generated URL. It's not the most elegant solution but it will work for majority of people this affects.
@ollietb
Copy link
Author

ollietb commented Aug 27, 2015

This fixes #131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant