Perform image manipulations.
@param  string $source Source image binary data.
@param  array  $params The manipulation params.
@return string Manipulated image binary data.
329862
public function run($source, array $params)
    {
        $image = $this->imageManager->make($source);

        foreach ($this->manipulators as $manipulator) {
            $manipulator->setParams($params);

            $image = $manipulator->run($image);
        }

        return $image->getEncoded();
    }
250003
public function createInputStream($source, array $options = []): InputStream
    {
        return $this->streamFactory->createInputStream($this->prefix . $source, $options);
    }
1089628
public function setSource($source)
    {
        if (is_file($source)) {
            $info = getimagesize($source);

            $this->mime         = $info['mime'];
            $this->source       = $source;
            $this->sourceWidth  = $info[0];
            $this->sourceHeight = $info[1];
        }

        return $this;
    }
158471
public function getSourceChildPropertiesToBeConverted($source) {
		if (is_string($source)) {
			$source = [
				'payload' => [
					'__identity' => $source,
				]
			];
		} elseif (isset($source['__identity'])) {
			$source['payload'] = [
				'__identity' => $source['__identity'],
			];
			unset($source['__identity']);
		} elseif (!isset($source['payload'])) {
			$source['payload'] = [];
		}
		$source = parent::getSourceChildPropertiesToBeConverted($source);
		return $source;
	}
1001444
public function addImage($source = null, $attributes = [])
    {
        $validKeys = [
            'url',
            'secure_url',
            'type',
            'width',
            'height',
        ];

        if (is_array($source)) {
            $this->images[] = $this->cleanProperties($source, $validKeys);
        } else {
            $this->images[] = [
                $source,
                $this->cleanProperties($attributes, $validKeys),
            ];
        }

        return $this;
    }
770469
protected static function _compileCommand($command,array $params){
        $s = $w = [];
        foreach ($params as $p) {
            if ($p instanceof static) {
              $s[] = '$('.$p->getShellCommand().')';
            } else if (is_array($p)) foreach ($p as $key => $value) {
                if(is_numeric($key)){
                  $w[] = '--'.$value;
                } else {
                  if(is_bool($value)){
                     if($value) $w[] = '--'.$key;
                  } else {
                    $w[] = '--'.$key.'='.escapeshellarg($value);
                  }
                }
            } else {
              $s[] = $p;
            }
        }
        return trim(
            '/usr/bin/env '.$command.' '.implode(' ',array_merge($w,$s))
        );
    }
300089
protected function formatString($source, array $args, array $data = array())
    {
        if (!isset($data[0]) || $data[0] === '') {
            return gplcart_string_format($source, $args);
        }

        return gplcart_string_format($data[0], $args);
    }
26847
protected static function to_webp_sources(string &$from, &$to) {
		// Validate the source.
		ref\file::path($from, true);
		if (! $from) {
			$from = '';
			return false;
		}

		// We can only convert JPEG, PNG, and GIF sources.
		$info = mime::finfo($from);
		if (! \in_array($info['mime'], array('image/jpeg', 'image/gif', 'image/png'), true)) {
			$from = '';
			return false;
		}

		// Build a destination if we need to.
		if (null !== $to) {
			ref\cast::string($to, true);

			// If this is just a file name, throw it in from's dir.
			if (false === \strpos($to, '/')) {
				$to = "{$info['dirname']}/$to";
			}
			ref\file::path($to, false);
			if ('.webp' !== \substr(\strtolower($to), -5)) {
				$to = '';
				return false;
			}
		}
		// Just swap extensions with the source.
		else {
			$to = "{$info['dirname']}/{$info['filename']}.webp";
		}

		return true;
	}
625155
protected function sourceToStream($source): StreamInterface
    {
        if (is_string($source)) {
            $source = Psr7\try_fopen($source, 'r+');
        }

        return Psr7\stream_for($source);
    }
1267838
protected function encodeArrayName(array $source): string
    {
        $source = $this->encodeArray($source);
        $count = count($source);
        if ($count === 2 || $count === 3) {
            $name = array_pop($source);
            $method = implode('::', $source);
            return sprintf('%s() $%s parameter', $method, $name);
        } else {
            return implode('::', $source);
        }
    }
1143008
protected function getAssetSourceUrl(string $source): string
    {
        // If the source is not a complete URL, we will go ahead and prepend
        // the asset's path to the source provided with the asset. This will
        // ensure that we attach the correct path to the asset.
        if (! $this->isLocalPath($file = $this->path.'/'.\ltrim($source, '/'))) {
            return $file;
        }

        return $this->getAssetSourceUrlWithModifiedTime($source, $file);
    }
808421
public function generateIndex($source,$params)
	{
		$content=file_get_contents($source);
		$yii=realpath(dirname(__FILE__).'/../../yii.php');
		$yii=$this->getRelativePath($yii,$this->_rootPath.DIRECTORY_SEPARATOR.'index.php');
		$yii=str_replace('\\','\\\\',$yii);
		return preg_replace('/\$yii\s*=(.*?);/',"\$yii=$yii;",$content);
	}
661450
protected function unserialize($source)
    {
        $source = base64_decode($source);
        $result = @unserialize($source);
        if ($result === false && $source !== serialize(false)) {
            throw new \UnexpectedValueException();
        }
        return $result;
    }
1263768
public final static function encode(array $source): string {
		if (($source = json_encode($source)) == false && json_last_error() !== JSON_ERROR_NONE){
			throw new \Exception('Invalid raw data!');
		}

		return $source;
	}
1120697
public function setSource($source)
    {
        $sourceAttribute = $this->sourceAttribute;
        return (is_string($sourceAttribute) && !empty($sourceAttribute)) ? $this->$sourceAttribute = $source : null;
    }
766773
protected function getSourceImageDimensions($source): array
    {
        if ($source instanceof Asset) {
            return [$source->getWidth(), $source->getHeight()];
        }

        if ($this->profileConfig !== null && $this->profileConfig->getExternalImageDimensions) {
            $sourceModel = new LocalSourceImageModel($source);
            $sourceModel->getLocalCopy();

            $sourceImageInfo = @getimagesize($sourceModel->getFilePath());

            return [$sourceImageInfo[0], $sourceImageInfo[1]];
        }

        return [0, 0];
    }
501765
public function set_source($source) {
        $filerecord = new stdClass;
        $filerecord->source = $source;
        $this->update($filerecord);
    }