Create a mosaic

@return  string
766302
private function _mozifyMosaic()
	{
		//get image resource
		$resource = imagecreatefromstring(file_get_contents($this->imageUrl));

		//get the class
		$class = $this->getCssClassName();

		//build mosaic html
		$mosaic  = '<table width="' . $this->imageWidth . '" height="' . $this->imageHeight . '" cellspacing="0" cellpadding="0" border="0" bgcolor="#fefefe" class="' . $class . '">';
		$mosaic .= '<tbody>';
		for ($y = 0; $y < $this->imageHeight; $y+=$this->mosaicSize)
		{
			$mosaic .= '<tr>';
			for ($x = 0; $x < $this->imageWidth; $x+=$this->mosaicSize)
			{
				$color = imagecolorat($resource, $x, $y);
				$rgba = imagecolorsforindex($resource, $color);
				//$rgba['alpha'] = $rgba['alpha'];
				$color_string = $this->_rgb2hex($rgba);
				$mosaic .= '<td width="' . $this->mosaicSize . '" bgcolor="' . $color_string . '"><b></b></td>' . PHP_EOL;
			}
			$mosaic .= '</tr>' . PHP_EOL;
		}
		$mosaic .= '</tbody>';
		$mosaic .= '</table>';
		return $mosaic;
	}
488192
public function create()
	{
		$view = $this->getView();
		$siteid = $this->getContext()->getLocale()->getSiteId();
		$data = $view->param( 'characteristic/variant', [] );

		foreach( $view->value( $data, 'product.lists.id', [] ) as $idx => $value ) {
			$data['product.lists.siteid'][$idx] = $siteid;
		}

		$view->variantData = $data;
		$view->variantBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->variantBody .= $client->create();
		}

		return $this->render( $view );
	}
1208857
private function createTerra()
    {
        $terra = new Terra();
      // Get config from env variables or files.
        if ($config_env = getenv('TERRA')) {
            $config_env = Yaml::parse($config_env);
            $config = new Config($config_env);
        } else {
            $fs = new Filesystem();

            $user_config = array();
            $user_config_file = getenv('HOME').'/.terra/terra';
            if ($fs->exists($user_config_file)) {
                $user_config = Yaml::parse($user_config_file);
            }

            $project_config = array();
            $process = new Process('git rev-parse --show-toplevel');
            $process->run();
            if ($process->isSuccessful()) {
                $project_config_file = trim($process->getOutput()).'/terra.yml';
                if ($fs->exists($project_config_file)) {
                    $project_config = Yaml::parse($project_config_file);
                }
            }

            $config = new Config($user_config, $project_config);
        }
        $terra->setConfig($config);

        return $terra;
    }
879399
public function create()
	{
		$view = $this->addViewData( $this->getView() );
		$siteid = $this->getContext()->getLocale()->getSiteId();

		$itemData = $this->toArray( $view->item );
		$data = array_replace_recursive( $itemData, $view->param( 'media', [] ) );

		foreach( $data as $idx => $entry )
		{
			$data[$idx]['media.siteid'] = $siteid;
			$data[$idx]['media.url'] = $itemData[$idx]['media.url'];
			$data[$idx]['media.preview'] = $itemData[$idx]['media.preview'];
			$data[$idx]['product.lists.siteid'] = $siteid;
		}

		$view->mediaData = $data;
		$view->mediaBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->mediaBody .= $client->create();
		}

		return $this->render( $view );
	}
182021
public function create()
    {
        $this->data['mrkdwn_in'] = [];

        if ($this->markdownInText) {
            $this->data['mrkdwn_in'][] = 'text';
        }

        if ($this->markdownInPretext) {
            $this->data['mrkdwn_in'][] = 'pretext';
        }

        if ($this->markdownInFields) {
            $this->data['mrkdwn_in'][] = 'fields';
        }

        return Attachment::fromData($this->data);
    }
1173234
public function createMaterial()
    {
        $m = Material::factory( $this->materialsType, $this->materialsTable );
        $m->idcat = $this->id;
        return $m;
    }
873664
public function create() : string
    {
        return $this->prefix . self::createSlug($this->title) . $this->suffix;
    }
801384
public function create()
    {
        $instance = self::createCustomerGroup($this);
        $this->setId($instance->getId());
        return $instance;
    }
624809
public function create()
	{
		$view = $this->addViewData( $this->getView() );
		$siteid = $this->getContext()->getLocale()->getSiteId();
		$data = $view->param( 'stock', [] );

		foreach( $view->value( $data, 'stock.id', [] ) as $idx => $value ) {
			$data['stock.siteid'][$idx] = $siteid;
		}

		$view->stockData = $data;
		$view->stockBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->stockBody .= $client->create();
		}

		return $this->render( $view );
	}
219267
def get_mosaics(self):
        '''
        '''
        url = self._url('basemaps/v1/mosaics')
        return self._get(url, models.Mosaics).get_body()
50216
protected function prepareAttachment($mosaic)
    {
        if ($mosaic instanceof MosaicAttachment) {
            return $mosaic;
        }
        elseif ($mosaic instanceof MosaicAttachments) {
            return $mosaic->shift();
        }
        elseif ($mosaic instanceof Mosaic) {
            return new MosaicAttachment(["mosaicId" => $mosaic->toDTO()]);
        }
        elseif ($mosaic instanceof MosaicDefinition) {
            return new MosaicAttachment(["mosaicId" => $mosaic->id()->toDTO()]);
        }
        elseif (is_string($mosaic)) {
            return $this->prepareAttachment(Mosaic::create($mosaic));
        }

        throw new InvalidArgumentException("Unrecognized mosaic parameter type passed to \\NEM\\Models\\Transaction\\MosaicTransfer::attachMosaic().");
    }
1054439
static public function create(MosaicAttachments $mosaics = null, $networkId = 104)
    {
        if (! self::$definitions) {
            self::$definitions = new static([
                Registry::getDefinition("nem:xem")
            ]);
        }

        if ($mosaics === null) {
            return self::$definitions; // only contains nem:xem
        }

        $object = new static;

        // for each attached mosaic, we need the mosaic definition
        foreach ($mosaics as $attachment) {

            $mosaicId = is_array($attachment) ? $attachment["mosaicId"] : $attachment->mosaicId();
            $mosaic = $object->prepareMosaic($mosaicId);
            $definition = self::$definitions->getDefinition($mosaic);

            if (false !== $definition) {
                // definition found for current attached mosaic
                continue;
            }

            // try to use Registry
            $definition = Registry::getDefinition($mosaic);
            if (false !== $definition) {
                // mosaic definition *morphed* with Registry.
                self::$definitions->push($definition);
                continue;
            }

            // need network fetch

            // all definitions fetched will be stored in `self::$definitions`
            $definition = self::fetch($mosaic, $networkId);

            if (false === $definition) {
                throw new \InvalidArgumentException("Mosaic '" . $mosaic->getFQN() . "' does not exist on network: " . $networkId);
            }
        }

        return self::$definitions;
    }
1099141
public static function make()
    {
        $resolver = new TemplateResolver();

        $services = Provider::getServices();
        $config   = $services->get('Config');

        if (isset($config['error']['html']['templates'])) {
            $templates = (array) $config['error']['html']['templates'];
            foreach ($templates as $template => $path) {
                $resolver->setTemplate($template, $path);
            }
        }

        return $resolver;
    }
777599
public function actionCreate()
    {
        $name = $this->prompt("Please enter a name for the Active Window:", [
            'required' => true,
        ]);
        
        $className = $this->createClassName($name, $this->suffix);
        
        $moduleId = $this->selectModule(['text' => 'What module should '.$className.' belong to?', 'onlyAdmin' => true]);
        
        $module = Yii::$app->getModule($moduleId);
        
        $folder = $module->basePath . DIRECTORY_SEPARATOR . 'aws';
        
        $file = $folder . DIRECTORY_SEPARATOR . $className . '.php';
        
        $namespace = $module->getNamespace() . '\\aws';
        
        if (FileHelper::createDirectory($folder) && FileHelper::writeFile($file, $this->renderWindowClassView($className, $namespace, $moduleId))) {
            $object = Yii::createObject(['class' => $namespace . '\\' . $className]);
            
            if (FileHelper::createDirectory($object->getViewPath()) && FileHelper::writeFile($object->getViewPath() . DIRECTORY_SEPARATOR . 'index.php', $this->renderWindowClassViewFile($className, $moduleId))) {
                $this->outputInfo("View file generated.");
            }
            
            return $this->outputSuccess("Active Window '$file' created.");
        }
        
        return $this->outputError("Error while writing the Actice Window file '$file'.");
    }
1339507
public function create(): Letter
    {
        $multipartElements = [
            [
                'name'     => 'envelope',
                'contents' => \GuzzleHttp\json_encode($this->getEnvelope()),
                'headers'  => ['Content-Type' => $this->getEnvelope()->getMimeType()],
            ],
        ];

        if ($this->getCoverLetter()) {
            $multipartElements[] = [
                'name'     => 'cover_letter',
                'contents' => $this->getCoverLetter(),
                'headers'  => ['Content-Type' => 'text/html'],
            ];
        }

        foreach ($this->getAttachments() as $attachment) {
            $multipartElements[] = [
                'name'     => 'file',
                'contents' => fopen($attachment, 'rb'),
                'headers'  => ['Content-Type' => static::getMimeTypeOfFile($attachment)],
            ];
        }

        $multipart      = new MultipartStream($multipartElements);
        $requestOptions = [
            'headers' => [
                'Content-Type' => 'multipart/mixed; boundary='.$multipart->getBoundary(),
            ],
            'body'    => $multipart,
        ];

        $response = $this->getHttpClientForMailbox()->request('POST', '/letters', $requestOptions);
        $data     = \GuzzleHttp\json_decode($response->getBody()->getContents());

        $this->setLetterId($data->letterId);

        return $this;
    }
532048
public static function createSalt()
    {
        $salt = Random::createString(self::SALT_START_LENGTH);
        $base64 = base64_encode($salt);
        $salt = self::convertAlphabets($base64);
        return Binary::getSlice($salt, 0, self::SALT_FINAL_LENGTH);
    }
594202
public function build(): CaptureScreenshotRequest
	{
		$instance = new CaptureScreenshotRequest();
		$instance->format = $this->format;
		$instance->quality = $this->quality;
		$instance->clip = $this->clip;
		$instance->fromSurface = $this->fromSurface;
		return $instance;
	}