Get Image resource.

@param $string string.
$size side of image.
$color foreground color of image.
$bg background color of image.

@since 3.0.0

@return resource
976965
public function getImgResource($string, $size = 128, $color = '', $bg = '')
    {
        return $this->_instance->getImgResource($string, $size, $color, $bg);
    }
1068252
public function write($string)
    {
        $length = strlen($string);

        $start = substr($this->resource, 0, $this->pointer);
        $end = substr($this->resource, $this->pointer + $length);

        $this->resource = $start . $string . $end;

        $this->pointer = strlen($start . $string);

        return $string;
    }
578818
public static function get_image_size($size)
    {
        $sizes = static::get_image_sizes();

        if (\is_string($size) && isset($sizes[ $size ])) {
            return $sizes[ $size ];
        }

        return false;
    }
1312927
public function displayImage($string, $size = 64, $color = null, $backgroundColor = null)
    {
        $imageData = $this->getImageData($string, $size, $color, $backgroundColor);

        return Response::make($imageData, 200, ['Content-Type' => 'image/png']);
    }
425811
public function search(string $string, string $resources = ''): array
    {
        $query = $this->getRepository('Search')
            ->query()
            ->setParameter('query', $string);
        if ($resources) {
            $query->setParameter('resources', \mb_strtolower($resources));
        }

        return $query->find();
    }
656072
public static function getColoredString($string, $foreground_color = '', $background_color = '')
    {
        $colored_string = '';

        // Check if given foreground color exists
        if (isset(static::$foreground_colors[$foreground_color])) {
            $colored_string .= "\033[".static::$foreground_colors[$foreground_color].'m';
        }

        // Check if given background color exists
        if (isset(static::$background_colors[$background_color])) {
            $colored_string .= "\033[".static::$background_colors[$background_color].'m';
        }

        if ($colored_string) {
            // Add string and end coloring
            $colored_string .= $string."\033[0m";
        } else {
            $colored_string = $string;
        }

        return $colored_string;
    }
19790
private function createStyleFromString($string)
    {
        if (isset($this->styles[$string])) {
            return $this->styles[$string];
        }

        if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) {
            return false;
        }

        $style = new OutputFormatterStyle();
        foreach ($matches as $match) {
            array_shift($match);

            if ('fg' == $match[0]) {
                $style->setForeground($match[1]);
            } elseif ('bg' == $match[0]) {
                $style->setBackground($match[1]);
            } elseif ('options' === $match[0]) {
                preg_match_all('([^,;]+)', $match[1], $options);
                $options = array_shift($options);
                foreach ($options as $option) {
                    try {
                        $style->setOption($option);
                    } catch (\InvalidArgumentException $e) {
                        @trigger_error(sprintf('Unknown style options are deprecated since version 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), E_USER_DEPRECATED);

                        return false;
                    }
                }
            } else {
                return false;
            }
        }

        return $style;
    }
1083480
public static function __getInstance($string)
    {
        $engine = self::detectBank($string);
        $engine->loadString($string);

        return $engine;
    }
1171002
public function getImage(): string
    {
        if (is_resource($this->image)) {
            $this->image = (string) stream_get_contents($this->image);
        }
        return $this->image;
    }
777474
public function convert($string)
    {
        $css = self::parse($string);
        $data = self::formatCssArray($css);
        $this->data = $data;
        return $data;
    }
32470
public function getUrlImage($size = "", $name = "")
    {
        if (!empty($size)) {
            $size.="/";
        }
        return $this->getUrlRacine()."images/".$size.$name;
    }
1017838
public static function get_image_size( $size ) {
		// Check for a directly passed image configuration array.
		if ( is_array( $size ) ) {
			return $size;
		}

		$sizes = self::get_image_sizes();

		// Return found image size.
		if ( isset( $sizes[ $size ] ) ) {
			return $sizes[ $size ];
		}

		self::notice( "Image size \"{$size}\" does not exist in your image configuration." );

		return false;
	}
248588
public function getCoverSource($size = ComPhotosDomainEntityPhoto::SIZE_SQUARE)
    {
        $cover = $this->photos->order('photoSets.ordering')->fetch();
        $filename = $cover->filename;

        //get file extension
        $extension = explode('.', $filename);
        $extension = array_pop($extension);

        //remove file extension
        $name = preg_replace('#\.[^.]*$#', '', $filename);
        $filename = $name.'_'.$size.'.'.$extension;

        return $this->owner->getPathURL('com_photos/'.$filename);
    }
1205855
private function getResource()
    {
        if ($this->mime == 'image/gif') {
            return imagecreatefromgif($this->source);
        }
        elseif ($this->mime == 'image/jpg' || $this->mime == 'image/jpeg') {
            return imagecreatefromjpeg($this->source);
        }
        elseif ($this->mime == 'image/png') {
            return imagecreatefrompng($this->source);
        }
        else
            return null;

    }
394800
public function getThumbnail($size = self::IMG_SIZE_THUMBNAIL)
    {
        /*
         * Define a func for to get the attachment-src from the post_id
         */
        $getSrc = function ($_id) use ($size) {
            $imageObject = wp_get_attachment_image_src(get_post_thumbnail_id($_id), $size);
            if (empty($imageObject)) {
                return false;
            }
            return $imageObject[0];
        };

        if (($imageObject = $getSrc($this->ID))) {
            return $imageObject;
        }
        // if they aren't, we get the first img from the post, and let it as thumbnail
        preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $this->post_content, $matches);
        $src = isset($matches[1]) ? $matches[1] : '';
        $attachmentId = Utils::getAttachmentIdFromUrl($src);
        // try to set the first img as thumbnail
        set_post_thumbnail($this->ID, $attachmentId);
        /*
         * In case we found it return the img src from wp_get_attachment_image_src()
         * Othercase return the raw source
         */
        if (($imageObject = $getSrc($this->ID))) {
            return $imageObject;
        }

        return $src;
    }
1236835
public function getImgDataBase64($string, $size = 128, $color = '', $bg = '')
    {
        return sprintf('data:%s;base64,%s', $this->_instance->mineType, base64_encode($this->getImgData($string, $size, $color, $bg)));
    }
657417
public function displayImage($string, $size = 64, $hexaColor = null)
	{
		header("Content-Type: image/png");
		$this->generateImage($string, $size, $hexaColor);
	}