src/Cloudinary.php
public static function cloudinary_scaled_url($source, $width, $transformation, $options)
    {
        if (!empty($transformation)) {
            // Replace transformation parameters in $options with those in $transformation

            if(is_string($transformation)){
                $transformation = array("raw_transformation"=> $transformation);
            }
            $options = self::array_subset($options, self::$URL_KEYS);
            $options = array_merge($options, $transformation);
        }

        $scale_transformation = ["crop" => "scale", "width" => $width];

        self::check_cloudinary_field($source, $options);
        self::patch_fetch_format($options);
        $options = self::chain_transformations($options, $scale_transformation);

        return cloudinary_url_internal($source, $options);
    }
public static function cloudinary_scaled_url($source, $width, $transformation, $options)
    {
        if (!empty($transformation)) {
            // Replace transformation parameters in $options with those in $transformation

            if(is_string($transformation)){
                $transformation = array("raw_transformation"=> $transformation);
            }
            $options = self::array_subset($options, self::$URL_KEYS);
            $options = array_merge($options, $transformation);
        }

        $scale_transformation = ["crop" => "scale", "width" => $width];

        self::check_cloudinary_field($source, $options);
        self::patch_fetch_format($options);
        $options = self::chain_transformations($options, $scale_transformation);

        return cloudinary_url_internal($source, $options);
    }
public static function cloudinary_scaled_url ( $ source , $ width , $ transformation , $ options ) { if ( ! empty ( $ transformation ) ) { // Replace transformation parameters in $options with those in $transformation if ( is_string ( $ transformation ) ) { $ transformation = array ( "raw_transformation" => $ transformation ) ; } $ options = self :: array_subset ( $ options , self :: $ URL_KEYS ) ; $ options = array_merge ( $ options , $ transformation ) ; } $ scale_transformation = [ "crop" => "scale" , "width" => $ width ] ; self :: check_cloudinary_field ( $ source , $ options ) ; self :: patch_fetch_format ( $ options ) ; $ options = self :: chain_transformations ( $ options , $ scale_transformation ) ; return cloudinary_url_internal ( $ source , $ options ) ; }
Generates a cloudinary url scaled to specified width.

In case transformation parameter is provided, it is used instead of transformations specified in $options

@param string       $source         Public ID of the resource
@param int          $width          Width in pixels of the srcset item
@param array|string $transformation Custom transformation that overrides transformations provided in $options
@param array        $options        Additional options

@return null|string
Generates a cloudinary url scaled to specified width .