-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Img helper size config #10182
Img helper size config #10182
Conversation
core/server/helpers/proxy.js
Outdated
@@ -40,6 +40,8 @@ module.exports = { | |||
isPrivacyDisabled: config.isPrivacyDisabled.bind(config) | |||
}, | |||
|
|||
activeTheme: require('../services/themes/active'), |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Additional note this PR has the ability to specify only widths/heights which conflicts with the spec and needs confirmation |
We've agreed it is preferable to allow either width, height or both. |
I've updated the PR description to reflect the new url structure i.e |
core/server/helpers/img_url.js
Outdated
return imagePath; | ||
} | ||
|
||
if (/https?:\/\//.test(imagePath)) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This reverts commit 3a2accb.
no-issue This is to support the v2 content api, which uses absolute urls for images. The approach here is to split the url apart, and join it back together, injecting the size directory in the middle.
@ErisDS This has been updated to work with absolute urls when they belong to the blog domain. Which means v2 content api compat |
refs #10181
Given a theme with a
package.json
with animage_sizes
object like this:(N.B. the
small
key must have at least a height or a width, or both)Using the
img_url
helper in the theme likeWill render to
If the
package.json
of the theme does not define theimage_sizes
object or the requested size is not included in theimage_sizes
object, the original image will be served.