Get a random image.

@param string      $type
@param string|null $placeholder

@return array|null
335513
private function getRandomImage($type, $placeholder)
    {
        $pathKey = $type === 'image' ? 'file' : 'filename';

        if ($placeholder && ($filename = $this->fetchPlaceholder($placeholder))) {
            return [$pathKey => $filename, 'title' => 'placeholder', 'alt' => 'placeholder'];
        }

        $images = $this->getImageFiles();
        if (empty($images)) {
            return null;
        }
        $imageName = array_rand($images);
        $image = $images[$imageName];
        $title = $image->getFilename($image->getExtension());
        $title = ucwords(str_replace('-', ' ', $title));

        return [$pathKey => $image->getPath(), 'title' => $title, 'alt' => $title];
    }
1259750
public function getImageBlob($type = self::IMAGE_JPG, $getHtmlTag = false)
    {
        $location = sprintf(__DIR__.'/../../assets/OpenWeather/%s/%s.%s', $type, $this->image, $type);
        $blob = sprintf('data:image/%s;base64,%s',
            $type,
            base64_encode(file_get_contents($location))
        );

        if ($getHtmlTag) {
            return sprintf(
                '<img src="%s" alt="%s" title="%s" class="open-weather-image">',
                $blob,
                $this->description,
                $this->description
            );
        }

        return $blob;
    }
312307
private static function getSourceFunction(?int $imgType = null): ?string
    {
        switch ($imgType) {
            case IMAGETYPE_JPEG:
                $src['function'] = 'imagecreatefromjpeg';
                break;
            case IMAGETYPE_PNG:
                $src['function'] = 'imagecreatefrompng';
                break;
            case IMAGETYPE_GIF:
                $src['function'] = 'imagecreatefromgif';
                break;
            default:
                $src['function'] = null;
                break;
        }
        return $src['function'];
    }
495851
public final static function instance($type = null) {
        global $PAGE;

        if ($type == null) {
            if (!empty(self::$instance)) {
                return self::$instance;
            }
            $type = $PAGE->theme->get_icon_system();
            self::$instance = new $type();
            // Default one is a singleton.
            return self::$instance;
        } else {
            // Not a singleton.
            return new $type();
        }
    }
126954
public static function get($key = null, $type = 'string', $defaultValue = '')
    {
        if (!$key) {
            return $_GET;
        }
        return self::typeConvert(isset($_GET[$key]) ? $_GET[$key] : $defaultValue, $type);
    }
369335
public static function string( $string, $type = null ) 
	{
		$image = imagecreatefromstring( $string );

		if ( $image !== false ) 
		{
			return new static( $image, $type );
		}

		return false;
	}
1276335
public function getImageSrc($type, $size)
	{
		if (empty($this->$type))
		{
			return null;
		}
		return $this->getImageConfig($type, $size, 'dir') . $this->$type;
	}
975760
function ($placeholder) {
			$.fn.mediumInsert.insert.deselect();


			var formHtml = '<div class="medium-editor-toolbar medium-editor-toolbar-active medium-editor-toolbar-form-anchor mediumInsert-embedsWire" style="display: block;"><input type="text" value="" placeholder="' + this.options.urlPlaceholder + '" class="mediumInsert-embedsText medium-editor-toolbar-anchor-input"></div>';
			$(formHtml).appendTo($placeholder.prev());
			setTimeout(function () {
				$placeholder.prev().find('input').focus();
			}, 50);

			$.fn.mediumInsert.insert.deselect();

			this.currentPlaceholder = $placeholder;
			$(".mediumInsert-embedsText").focus();
		}
275762
public function get($type, $domain = null)
    {
        $this->handle($domain);

        return $this->getSession()->getFlashBag()->get($type);
    }
869654
function createPlaceHolder($page, type) {
        var placeHolders = { kittens : 'placekitten.com', bears: 'placebear.com', lorem: 'lorempixel.com',
            bacon: 'baconmockup.com', murray: 'www.fillmurray.com'};
        var gallery = '';
        for (var i = 0; i < getRandomInt(50,100); i++) {
            gallery += '<li class="photoClass" style="background:url(http://' + placeHolders[type] + '/' +
                getRandomInt(200,300) + '/' + getRandomInt(200,300) + ') 50% 50% no-repeat"></li>';
        }
        $page.find('.photo-gallery').html(gallery);
        tt.refreshScroll(); // Refresh the scroller
        tt.scrollTo(0,0);   // Move back to the top of the page...
    }
415365
public function generate(String $type = NULL, String $save = NULL)
    {
        $canvas = $this->canvas;
        
        if( ! empty($type) )
        {
            $this->type = $type;
        }

        if( ! empty($save) )
        {
            $this->save = $save;
        }

        if( empty($this->save) && $this->output === true )
        {
            $this->getImageContent();
        }

        $this->generateImageType();
        $this->destroyImage();
        $this->defaultVariables();

        return $canvas;
    }
973327
public function random($length = 32, $type = self::RAND_ALL)
    {
        $string = '';

        // todo: make to halper?
        foreach ($this->dictionary as $pos => $item)
        {
            $key = (1 << $pos);
            if ($type >= $key)
            {
                $string .= $item;
                $type -= $key;
            }
        }

        if (empty($string))
        {
            throw new \InvalidArgumentException("Invalid random string type [{$type}].");
        }

        return $this->rand($string, $length);
    }
430791
public function setPlaceholder ($placeholder = null)
    {
        if ($placeholder === false)
            $this->usePlaceholder = false;
        else {
            $this->setSelect2Options(array(
                self::SELECT2_OPTION_PLACEHOLDER => $placeholder === null ? $this->label : $placeholder
            ));
            $this->usePlaceholder = true;
        }
        return $this;
    }
379322
public function addPlaceholder($placeholder)
    {
        if (!isset(class_implements($placeholder)[PlaceholderInterface::class])) {
            throw new InvalidArgumentException('The class ['.$placeholder.'] should be a member of the ['.PlaceholderInterface::class.']');
        } elseif (in_array($placeholder, $this->placeholders)) {
            throw new InvalidArgumentException('The placeholder ['.$placeholder.'] is already added to the minifier!');
        }

        $this->placeholders[] = $placeholder;

        return $this->placeholders;
    }
1323013
public function thumbnail($type = 'auto')
    {
        if ($type !== 'auto' && !\in_array($type, $this->thumbnailTypes, true)) {
            return $this;
        }

        if ($this->thumbnailType !== $type) {
            $this->_thumbnail = null;
        }

        $this->thumbnailType = $type;

        return $this;
    }
995222
def placeholder(type_):
    """"""
    typetuple = type_ if isinstance(type_, tuple) else (type_,)
    if any in typetuple:
        typetuple = any
    if typetuple not in EMPTY_VALS:
        EMPTY_VALS[typetuple] = EmptyVal(typetuple)
    return EMPTY_VALS[typetuple]
923016
public static function get($type = null) {
        return is_null($type) ? self::$_messages : (isset(self::$_messages[$type]) ? self::$_messages[$type] : []);
    }