Tabnine Logo
Thumbnail
Code IndexAdd Tabnine to your IDE (free)

How to use
Thumbnail
in
com.atlassian.core.util.thumbnail

Best Java code snippets using com.atlassian.core.util.thumbnail.Thumbnail (Showing top 17 results out of 315)

origin: com.atlassian.core/atlassian-core-thumbnail

  /**
   * Returns a string representing the internal values of this <code>Thumbnail</code> object. This string contains the
   * MIME Media type, width and height of this <code>Thumbnail</code> object.
   *
   * @return a string representation of this <code>Thumbnail</code> object
   */
  @Override
  public String toString() {
    return getClass().getName() + " [MimeType=" + mimeType + ",width=" + getWidth() + ",height=" + getHeight() + ",filename=" + getFilename() + ",attachmentId=" + getAttachmentId() + "]";
  }
}
origin: com.atlassian.streams/streams-confluence-plugin

public Preview(Attachment attachment, Thumbnail thumbnail)
{
  this.downloadPath = attachment.getDownloadPath();
  this.height = thumbnail.getHeight();
  this.width = thumbnail.getWidth();
}
origin: com.atlassian.jira/jira-core

return new Thumbnail(thumbnail.getHeight(), thumbnail.getWidth(), thumbnailFile.getName(), attachment.getId(),
    thumbnail.getMimeType());
origin: com.atlassian.streams/streams-jira-plugin

  public ThumbnailItem apply(Thumbnail thumbnail)
  {
    if (thumbnail.getFilename() == null)
    {
      return brokenThumbnailItem(attachment, baseUri);
    }
    return new ThumbnailItem(
        uriProvider.getThumbnailUri(baseUri, thumbnail),
        uriProvider.getAttachmentUri(baseUri, attachment),
        scaleToThumbnailSize(thumbnail.getWidth(), thumbnail.getHeight()));
  }
};
origin: com.atlassian.streams/streams-jira-plugin

public URI getThumbnailUri(URI baseUri, Thumbnail thumbnail)
{
  return URI.create(baseUri.toASCIIString() + "/secure/thumbnail/" +
    thumbnail.getAttachmentId() + "/" + Uris.encode(thumbnail.getFilename()));
}
origin: com.atlassian.core/atlassian-core-thumbnail

private Thumbnail getThumbnail(File thumbnailFile, String filename, long thumbId) throws IOException {
  if (thumbnailFile.exists()) {
    final Image thumbImage = getImage(thumbnailFile, Predicates.<ReusableBufferedInputStream>alwaysTrue());
    return new Thumbnail(thumbImage.getHeight(null), thumbImage.getWidth(null), filename, thumbId, mimeType);
  }
  return null;
}
origin: com.atlassian.jira/jira-core

@Override
public int getHeight()
{
  return thumbnail.getHeight();
}
origin: com.atlassian.jira/jira-core

@Override
public int getWidth()
{
  return thumbnail.getWidth();
}
origin: com.atlassian.jira/jira-core

@Override
public String getFilename()
{
  return thumbnail.getFilename();
}
origin: com.atlassian.jira/jira-core

@Override
public long getAttachmentId()
{
  return thumbnail.getAttachmentId();
}
origin: com.atlassian.jira/jira-core

@Override
public boolean equals(Object o)
{
  if (this == o) { return true; }
  if (o == null || getClass() != o.getClass()) { return false; }
  AttachmentItem that = (AttachmentItem) o;
  if (!attachment.equals(that.attachment)) { return false; }
  if (thumbnail != null ? !thumbnail.equals(that.thumbnail) : that.thumbnail != null) { return false; }
  return true;
}
origin: com.atlassian.jira/jira-core

@Override
public String getMimeType()
{
  return thumbnail.getMimeType().name();
}
origin: com.atlassian.jira/jira-core

@Override
@HtmlSafe
public String getImageURL()
{
  if (thumbnail == null)
  {
    return null;
  }
  if (thumbnail instanceof BrokenThumbnail)
  {
    return velocityRequestContext.getCanonicalBaseUrl() + BROKEN_THUMBNAIL_URL;
  }
  return String.format("%s/secure/thumbnail/%s/%s", velocityRequestContext.getCanonicalBaseUrl(), thumbnail.getAttachmentId(), urlEncode(thumbnail.getFilename()));
}
origin: com.atlassian.core/atlassian-core-utils

private Thumbnail getThumbnail(File thumbnailFile, String filename, long thumbId) throws IOException
{
  if (thumbnailFile.exists())
  {
    final Image thumbImage = getImage(thumbnailFile);
    return new Thumbnail(thumbImage.getHeight(null), thumbImage.getWidth(null), filename, thumbId);
  }
  return null;
}
origin: com.atlassian.core/atlassian-core-thumbnail

private Thumbnail createThumbnail(InputStream inputStream, File thumbnailFile, int maxWidth, int maxHeight, long thumbId, String fileName)
    throws IOException, ThumbnailRenderException {
  final BufferedImage thumbnailImage = scaleImage(maxWidth, maxHeight, inputStream);
  final int height = thumbnailImage.getHeight();
  final int width = thumbnailImage.getWidth();
  storeImage(thumbnailImage, thumbnailFile);
  return new Thumbnail(height, width, fileName, thumbId, mimeType);
}
origin: com.atlassian.core/atlassian-core-utils

private Thumbnail createThumbnail(InputStream originalFile, File thumbnailFile, int maxWidth, int maxHeight, long thumbId, String fileName) throws IOException, FileNotFoundException
{
  // Load original image.
  Image originalImage = getImage(originalFile);
  // Create scaled buffered image from original image.
  BufferedImage scaledImage = scaleImage(originalImage, maxWidth, maxHeight);
  int height = scaledImage.getHeight();
  int width = scaledImage.getWidth();
  storeImage(scaledImage, thumbnailFile);
  return new Thumbnail(height, width, fileName, thumbId);
}
origin: com.atlassian.jira/jira-core

private Thumbnail readThumbnail(@Nonnull final Attachment attachment, @Nonnull final File thumbnailFile)
{
  if (thumbnailFile.exists())
  {
    log.debug("Thumbnail file '{}' already exists. Returning existing thumbnail.", thumbnailFile);
    InputStream inputStream = null;
    try
    {
      inputStream = new FileInputStream(thumbnailFile);
      final ThumbnailDimension thumbnailDimension = ThumbnailUtil.dimensionsForImage(inputStream);
      return new Thumbnail(thumbnailDimension.getHeight(), thumbnailDimension.getWidth(),
          thumbnailFile.getName(), attachment.getId(), MIME_TYPE);
    }
    catch (IOException asd)
    {
      log.debug("Unable to read image data from existing thumbnail file '{}'. Deleting this thumbnail.", thumbnailFile);
      deleteQuietly(thumbnailFile);
    }
    finally
    {
      closeQuietly(inputStream);
    }
  }
  return null;
}
com.atlassian.core.util.thumbnailThumbnail

Javadoc

The thumbnail image metadata of an image attachment.

Most used methods

  • getHeight
  • getWidth
  • <init>
    Creates an instance of Thumbnail with the provided arguments.
  • getAttachmentId
    the id of the attachment for which this is a thumbnail of
  • getFilename
    Get the filename of the file this thumbnail represents.
  • equals
    Checks whether two Thumbnail objects have equal values.
  • getMimeType
    Return the MIME Media type for thumbnail.
  • hashCode
    Returns the hash code for this Thumbnail.

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now