Curious if I'm able to use the resizer on a random, sourced image, not coming from a field anywhere.
So I would just be passing a string to the path of the image.
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.
Sign up to join this communityCurious if I'm able to use the resizer on a random, sourced image, not coming from a field anywhere.
So I would just be passing a string to the path of the image.
While transforms are an asset-only feature, you can get at all of the underlying image manipulation features pretty easily using the ImagesService.
$image = craft()->images->loadImage($imageSource);
$image->setQuality($quality);
$image->resize($transform->width, $transform->height);
$image->saveAs($targetFile);
mode
and position
– peirix
May 8 '15 at 12:21
width
, height
, quality
, mode
and position
, like I would do with a regular assets transform. But I found that the $image
will have both scaleAndCrop
(which will take position
) and scaleToFit
.
– peirix
May 10 '15 at 20:01
No.
A transform can only be applied to an AssetFileModel, and there is no AssetFileModel for a random image.