Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 12 down vote accepted

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->resize($transform->width, $transform->height);
share|improve this answer
and that pretty much sums up why i love craft!! – Ben Croker Jun 30 '14 at 21:41
Lovely! Looks like I just need a quick plugin to do this from Twig. – Tim Kelty Jul 1 '14 at 14:42
Any pointers on how I could get the two other transform parameters to work? mode and position – peirix May 8 '15 at 12:21
@peirix Not sure I’m following - probably worth posting as a new question. – Brandon Kelly May 9 '15 at 0:20
@BrandonKelly I actually figured it out. What I was after was a way to send in 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


A transform can only be applied to an AssetFileModel, and there is no AssetFileModel for a random image.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.