Generate a Youtube video iframe

@param null $mixWidth
@param null $height
@return string
515182
public static function video($mixWidth = null, $height = null)
    {

        $defParam = array(
            'width' => 560,
            'height' => 315,
            'src' => '//www.youtube.com/embed/0af00UcTO-c',
            'frameborder' => 0,
            'allowfullscreen' => 'true'
        );

        $param = array();

        if (is_integer($mixWidth)) {
            $param['width'] = $mixWidth;
        }

        if (!$height && is_integer($height)) {
            $param['height'] = $height;
        }

        $param = array_merge($defParam, $param);

        return '<iframe ' . Html::attributes($param) . '></iframe>';

    }
1051711
public function show($sString, $iWidth = null, $iHeight = null)
    {
        $rImg = $this->generateBarcode($sString, $iWidth, $iHeight);

        if ($rImg) {

            header('Content-Type: image/png');
            imagepng($rImg);
            imagedestroy($rImg);
            exit(0);

        } else {

            return false;
        }
    }
158390
function getiframeDocument($iframe) {
            var iframeDoc = $iframe[0].contentWindow || $iframe[0].contentDocument;
            if (iframeDoc.document) {
                iframeDoc = iframeDoc.document;
            }
            return iframeDoc;
        }
878315
def as_iframe(self, html_data):
        """"""

        srcdoc = html_data.replace('"', "'")
        return ('<iframe id="{div_id}", srcdoc="{srcdoc}" style="width: {width}; '
                'height: {height};"></iframe>'.format(
                    div_id=self.div_id,
                    srcdoc=srcdoc,
                    width=self.width,
                    height=self.height))
167962
public function size($width = null, $height = null)
    {
        foreach (\Config::get('flare-config.media.resize') as $sizeArray) {
            if ($width && $height && ($width == $sizeArray[0]) && ($height == $sizeArray[1])) {
                return $this->path ? url('uploads/media/'.$sizeArray[0].'-'.(array_key_exists(1, $sizeArray) ? $sizeArray[1] : $sizeArray[0]).'-'.$this->path) : null;
            }

            if ($width && ($width == $sizeArray[0])) {
                return $this->path ? url('uploads/media/'.$sizeArray[0].'-'.(array_key_exists(1, $sizeArray) ? $sizeArray[1] : $sizeArray[0]).'-'.$this->path) : null;
            }
        }

        return $this->link;
    }
479769
static function createImage( $width, $height, &$useTruecolor )
    {
        if ( $useTruecolor === null )
        {
//             print( "has GD2='" . eZImageInterface::hasGD2() . "'<br/>" );
            $useTruecolor = eZImageInterface::hasGD2();
        }
        if ( $useTruecolor and
             !function_exists( 'ImageCreateTrueColor' ) )
        {
            eZDebug::writeWarning( 'Function ImageCreateTrueColor does not exist, cannot create true color images', __METHOD__ );
            $useTruecolor = false;
        }
        if ( $useTruecolor )
            $imageObject = ImageCreateTrueColor( $width, $height );
        else
            $imageObject = ImageCreate( $width, $height );
        return $imageObject;
    }
245318
public function create($filename, $width, $height = null)
    {
        try {
            $image = app('image')->make($this->file->realPath)
                ->fit($width, ($height ?: $width))
                ->encode();

            $this->file->storage->put($this->file->path($filename), $image);
        } catch (NotReadableException $e) {
            return null;
        }

        return $this->file->storage->url($this->file->path($filename));
    }
1156214
public function getLogoUrl($iWidth = null, $iHeight = null)
    {
        $iLogoId = $this->getLogoId();

        if (!empty($iLogoId) && !empty($iWidth) && !empty($iHeight)) {
            return cdnScale($iLogoId, $iWidth, $iHeight);
        } elseif (!empty($iLogoId)) {
            return cdnServe($iLogoId);
        } else {
            return null;
        }
    }
333054
private function createResponse($data, $iframe = false)
    {
        $serializer = SerializerBuilder::create()->build();

        if (is_array($data)) {
            foreach ($data as $k => $n) {
                if ($n instanceof MediaInterface) {
                    $data[$k] = $this->addInfosForFront($n);
                }
            }
        } else {
            if ($data instanceof MediaInterface) {
                $data = $this->addInfosForFront($data);
            }
        }

        if ($iframe) {
            return new Response(htmlentities($serializer->serialize($data, 'json')));
        } else {
            return new Response($serializer->serialize($data, 'json'));
        }
    }
555005
public function youtube($link, $width=480, $height=360) {
		$url = parse_url($link);
		if (!array_key_exists('query', $url)) {
			return "";
		}
		parse_str($url['query'], $query);
		$is_playlist = array_key_exists('list', $query);
		if ($is_playlist) {
			$playlist_id = $query['list'];
			$embed_url = "//www.youtube.com/embed?listType=playlist&list=$playlist_id";
		} else {
			$video_id = $query['v'];
			$embed_url = "//www.youtube.com/embed/$video_id";
		}

		return "<iframe width=\"$width\" height=\"$height\" src=\"$embed_url\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
	}
142886
public function getDiv($width = 500, $height = 400)
	{
	    $styleOptions = array('width'    =>    $width.'px', 
	                          'height'   =>    $height.'px'
	                         );
	    
	    return ChartRenderer::render( $this, $styleOptions );
	}
809645
public function getUrl($width=null, $height=null)
    {

        if ($width || $height) {
            return $this->urlForSize($width, $height);

        }

        if (!$this->url) {
            $this->url = new Url($this->__get('url'));
        }

        return $this->url;

    }
118073
function createIframe(config) {
    let { url, width, height, allow, callback, appendTo } = config;
    let iframe = document.createElement('iframe');
    let winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    iframe.className = 'vimeo-video gvideo';
    iframe.src = url;

    if (height) {
        if (isMobile && winWidth < 767) {
            iframe.style.height = ''
        } else {
            iframe.style.height = `${height}px`
        }
    }
    if (width) {
        iframe.style.width = `${width}px`
    }
    if (allow) {
        iframe.setAttribute('allow', allow)
    }
    iframe.onload = function() {
        addClass(iframe, 'iframe-ready');
        if (utils.isFunction(callback)) {
            callback()
        }
    };

    if (appendTo) {
        appendTo.appendChild(iframe);
    }
    return iframe;
}
378269
public function thumbnailAction($storageId, $height, $width)
    {
        $fileManager = $this->get('beaast.core.manager.file');

        /**
         * @var File $file
         */
        $file = $fileManager->findOneBy(['storageId' => $storageId]);

        if (!$file || !in_array($file->getExtension(), ['jpg', 'png', 'gif'], true)) {
            throw $this->createNotFoundException();
        }

        $filePath = $fileManager->getFilePath($file);

        $cacheFileName = 'thumbnail_'.$height.'_'.$width.'_'.$storageId.'.'.$file->getExtension();

        $cacheFilePath = $this->getParameter('kernel.root_dir').'/../var/storage/cache/'.$cacheFileName;
        if (!file_exists($cacheFilePath) && file_exists($filePath)) {
            $imagick = new \Imagick($filePath);
            $imagick->thumbnailImage($width, $height, true);
            file_put_contents($cacheFilePath, $imagick->getImageBlob());
        }

        return $this->cacheAction($cacheFileName);
    }
461540
public function imageUrl($width, $height, $fit): string
    {
        // Sign the URL, to protect against mass-resize attacks.
        $glide_key = Site::getPreference('glide-key');
        if (empty($glide_key)) {
            $glide_key = bin2hex(random_bytes(128));
            Site::setPreference('glide-key', $glide_key);
        }

        if (Auth::accessLevel($this->media->tree()) > $this->media->tree()->getPreference('SHOW_NO_WATERMARK')) {
            $mark = 'watermark.png';
        } else {
            $mark = '';
        }

        $url_builder = UrlBuilderFactory::create(WT_BASE_URL, $glide_key);

        $url = $url_builder->getUrl('index.php', [
            'route'     => 'media-thumbnail',
            'xref'      => $this->media->xref(),
            'ged'       => $this->media->tree()->name(),
            'fact_id'   => $this->fact_id,
            'w'         => $width,
            'h'         => $height,
            'fit'       => $fit,
            'mark'      => $mark,
            'markh'     => '100h',
            'markw'     => '100w',
            'markalpha' => 25,
            'or'        => 0,
            // Intervention uses exif_read_data() which is very buggy.
        ]);

        return $url;
    }
314483
protected function urlForSize($width, $height=null)
    {

        if (!$this->sizes) {
            return $this->getUrl();
        }

        $targetSize = $width instanceof Size ? $width : new Size($width, $height);
        $targetKey = "$targetSize";

        if (isset($this->optimalSizeCache[$targetKey])) {
            return $this->optimalSizeCache[$targetKey];
        }

        $optimalSize = $targetSize->findBest($this->sizes());

        if ($this->getSize()->equals($optimalSize)) {
            $this->optimalSizeCache[$targetKey] = $this->getUrl();
            return $this->optimalSizeCache[$targetKey];
        }

        $optimalKey = "$optimalSize";

        if (isset($this->sizeUrls[$optimalKey])) {
            $this->optimalSizeCache[$targetKey] = $this->sizeUrls[$optimalKey];
            return $this->optimalSizeCache[$targetKey];
        }

        return $this->getUrl();

    }
1156390
public function addIFrame($src, $windowWidth, $windowHeight, $thumb="", $title = "", $caption="", $width="", $height="")
	{
		$this->addXmlnukeObject(XmlnukeMediaItem::IFrameFactory($src, $windowWidth, $windowHeight, $thumb, $title, $caption, $width, $height));
	}