Returns the media link in the requested size.

@return
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;
    }
1265555
public int getLength() {
        int length = 8;

        int size = mAttributes.size();
        for (int i=0; i<size; i++) {
            length += mAttributes.get(i).getLength();
        }

        return length;
    }
339472
private Resource getMediaInlineResource(MediaRequest mediaRequest) {
    Resource resource = mediaRequest.getResource();
    if (resource == null) {
      return null;
    }

    // check if resource itself is a nt:file node
    if (JcrBinary.isNtFileOrResource(resource)) {
      return resource;
    }

    // check if child node exists which is a nt:file node
    String refProperty = StringUtils.defaultString(mediaRequest.getRefProperty(), mediaHandlerConfig.getMediaInlineNodeName());
    Resource mediaInlineResource = resource.getChild(refProperty);
    if (JcrBinary.isNtFileOrResource(mediaInlineResource)) {
      return mediaInlineResource;
    }

    // not found
    return null;
  }
908750
public function getLinkDensity()
    {
        $linkLength = 0;
        $textLength = mb_strlen($this->getTextContent(true));

        if (!$textLength) {
            return 0;
        }

        $links = $this->getAllLinks();

        if ($links) {
            /** @var DOMElement $link */
            foreach ($links as $link) {
                $linkLength += mb_strlen($link->getTextContent(true));
            }
        }

        return $linkLength / $textLength;
    }
304626
@Override
	public int getStructMaxSize() {
		final V factoryV = tree.factoryV();
		return super.getStructMaxSize() + (values.length * factoryV.byteLength()) + 4 + 4;
	}
973318
public int getResultingWidth() {

        int width = getResultingTargetWidth();
        if (width == -1) {
            if (isCropped()) {
                width = m_cropWidth;
            } else {
                width = m_orgWidth;
            }
        }
        return width;
    }
470615
private byte[] getLinkContent() throws IOException
   {
      ByteArrayOutputStream outStream = new ByteArrayOutputStream();

      byte[] firstItem = getFirstItem();
      writeInt(firstItem.length + 2, outStream);
      writeBytes(firstItem, outStream);

      byte[] lastItem = getLastItem();
      writeInt(lastItem.length + 2, outStream);
      writeBytes(lastItem, outStream);

      String[] pathes = servletPath.split("/");
      String root = pathes[pathes.length - 1];

      byte[] rootItem = getRootItem(root, servletPath);
      writeInt(rootItem.length + 2, outStream);
      writeBytes(rootItem, outStream);

      pathes = targetPath.split("/");
      StringBuilder curHref = new StringBuilder(servletPath);

      for (int i = 0; i < pathes.length; i++)
      {
         if ("".equals(pathes[i]))
         {
            continue;
         }
         String curName = pathes[i];
         curHref.append("/").append(curName);

         if (i < pathes.length - 1)
         {
            byte[] linkItem = getHreffedFolder(curName, curHref.toString());
            writeInt(linkItem.length + 2, outStream);
            writeBytes(linkItem, outStream);
         }
         else
         {
            byte[] linkFile = getHreffedFile(curName, curHref.toString());
            writeInt(linkFile.length + 2, outStream);
            writeBytes(linkFile, outStream);
         }

      }

      return outStream.toByteArray();
   }
1335902
public String getFileLink() {

        if (m_resource != null) {
            return A_CmsJspValueWrapper.substituteLink(m_cms, m_cms.getSitePath(m_resource));
        } else {
            return "";
        }
    }
1324292
private String buildScaledMediaUrl(Dimension dimension, CropDimension cropDimension) {
    String resourcePath = this.resource.getPath();

    // if parent resource is a nt:file resource, use this one as path for scaled image
    Resource parentResource = this.resource.getParent();
    if (JcrBinary.isNtFile(parentResource)) {
      resourcePath = parentResource.getPath();
    }

    // URL to render scaled image via {@link InlineRenditionServlet}
    String path = resourcePath + "." + ImageFileServlet.SELECTOR
        + "." + dimension.getWidth() + "." + dimension.getHeight()
        + (cropDimension != null ? "." + cropDimension.getCropString() : "")
        + (this.mediaArgs.isContentDispositionAttachment() ? "." + MediaFileServlet.SELECTOR_DOWNLOAD : "")
        + "." + MediaFileServlet.EXTENSION + "/"
        // replace extension based on the format supported by ImageFileServlet for rendering for this rendition
        + ImageFileServlet.getImageFileName(getFileName());

    // build externalized URL
    UrlHandler urlHandler = AdaptTo.notNull(this.adaptable, UrlHandler.class);
    return urlHandler.get(path).urlMode(this.mediaArgs.getUrlMode()).buildExternalResourceUrl(this.resource);
  }
995775
public long getLogoWidth() {
        try {
            val items = getLogoUrls();
            if (!items.isEmpty()) {
                return items.iterator().next().getWidth();
            }
        } catch (final Exception e) {
            LOGGER.debug(e.getMessage(), e);
        }
        return DEFAULT_IMAGE_SIZE;
    }
523064
public int getSize() {
        return (java.lang.Integer) getStateHelper().eval(PropertyKeys.size, Integer.MIN_VALUE);

    }
1353720
protected @Nullable HtmlElement<?> getImageElement(@NotNull Media media) {
    Image img = null;

    MediaArgs mediaArgs = media.getMediaRequest().getMediaArgs();
    Asset asset = media.getAsset();
    Rendition rendition = media.getRendition();

    String url = null;
    if (rendition != null) {
      url = rendition.getUrl();
    }

    if (url != null) {
      img = new Image(url);

      // Alternative text
      String altText = null;
      if (asset != null) {
        altText = asset.getAltText();
      }
      if (StringUtils.isNotEmpty(altText)) {
        img.setAlt(altText);
      }

      // set width/height
      if (rendition != null && mediaArgs.getImageSizes() == null && mediaArgs.getPictureSources() == null) {
        long height = rendition.getHeight();
        if (height > 0) {
          img.setHeight(height);
        }
        long width = rendition.getWidth();
        if (width > 0) {
          img.setWidth(width);
        }
      }

      // set image sizes/srcset
      ImageSizes imageSizes = mediaArgs.getImageSizes();
      if (imageSizes != null) {
        MediaFormat primaryMediaFormat = getFirstMediaFormatWithRatio(media);
        if (primaryMediaFormat != null) {
          String srcSet = getSrcSetRenditions(media, primaryMediaFormat, imageSizes.getWidths());
          if (srcSet != null) {
            img.setSrcSet(srcSet);
            img.setSizes(imageSizes.getSizes());
          }
        }
      }

    }

    // set additional attributes
    setAdditionalAttributes(img, media);

    return img;
  }
275651
public com.google.api.ads.admanager.axis.v201805.Size getSize() {
        return size;
    }
390771
private VideoFormat getLargestVideoFormat() {

		Format[] formats = device.getFormats();
		VideoFormat format = null;
		int area = 0;

		// find the largest picture format
		for (Format f : formats) {

			if (!(f instanceof VideoFormat) || !"RGB".equalsIgnoreCase(f.getEncoding())) {
				continue;
			}

			VideoFormat vf = (VideoFormat) f;
			Dimension dim = vf.getSize();

			int a = dim.width * dim.height;
			if (a > area) {
				area = a;
				format = vf;
			}
		}

		return format;
	}
305801
public int getWidth()
    {
        if (getAttributes().isDefined(Attribute.WIDTH))
        {
            final int wide = (int) (getAttributes().getWidth() + 0.5);

            if (wide > 0)
            {
                return wide;
            }
        }
        if (null != m_video)
        {
            return m_video.getVideoWidth();
        }
        return 0;
    }
132622
public int getSize() {
		if (size < 0) {
			size = logCache==null ? 0 : logCache.getSize();
			size += traceCache==null ? 0 : traceCache.getSize();
		}
		return size;
	}
535589
private String buildMediaUrl(Dimension scaledDimension) {

    // check for file extension filtering
    if (!isMatchingFileExtension()) {
      return null;
    }

    // check if image has to be rescaled
    if (scaledDimension != null) {

      // check if scaling is not possible
      if (scaledDimension.equals(SCALING_NOT_POSSIBLE_DIMENSION)) {
        return null;
      }

      // otherwise generate scaled image URL
      return buildScaledMediaUrl(scaledDimension, this.media.getCropDimension());
    }

    // if no scaling but cropping required builid scaled image URL
    if (this.media.getCropDimension() != null) {
      return buildScaledMediaUrl(this.media.getCropDimension(), this.media.getCropDimension());
    }

    if (mediaArgs.isContentDispositionAttachment()) {
      // if not scaling and no cropping required but special content disposition headers required build download url
      return buildDownloadMediaUrl();
    }
    else {
      // if not scaling and no cropping required build native media URL
      return buildNativeMediaUrl();
    }
  }