public function widen($img, $width, $outputFormat = null, $targetPath = null)
    {
        if ($targetPath && $this->cache->cached($targetPath)) {
            return;
        }

        list($ow, $oh) = $imgInfo = ImageFile::getSize($img);
        $srcImg = ImageFile::get($img, $imgInfo);

        if ($width == $ow) {
            if ($targetPath) {
                ImageFile::save($targetPath, $srcImg, ImageFile::getType($img, $outputFormat, $imgInfo));
            }
            return;
        }

        // calculate new size
        $nw = $width;
        $nh = round(($nw / $ow) * $oh);

        // save
        $dstImg = $this->resample($srcImg, $nw, $nh, $ow, $oh, $imgInfo);

        ImageFile::save($targetPath ?: $img, $dstImg, ImageFile::getType($img, $outputFormat, $imgInfo));
        ImageFile::clean(array(&$dstImg, &$srcImg));
    }