Created
March 19, 2018 08:21
-
-
Save zeropaper/bc5d48b112ebe62caed57364226be6c9 to your computer and use it in GitHub Desktop.
Drupal 8 generate style derivative image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// can be runned from the Devel execute PHP page | |
use Drupal\image\Entity\ImageStyle; | |
$path = 'public://2018-03/26756519_10155441271337695_6783993404862700965_o.jpg'; | |
$thumbnail = ImageStyle::load('article'); | |
dpm($thumbnail->buildUrl($path)); | |
$dest = $thumbnail->buildUri($path); | |
dpm($dest); | |
$created = $thumbnail->createDerivative($path, $dest); | |
dpm('created? ' . $created); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment