コード例 #1
0
  @JSON
  @Override
  public Blob getImage() {
    if (_imageBlobModel == null) {
      try {
        _imageBlobModel = LFImageLocalServiceUtil.getImageBlobModel(getPrimaryKey());
      } catch (Exception e) {
      }
    }

    Blob blob = null;

    if (_imageBlobModel != null) {
      blob = _imageBlobModel.getImageBlob();
    }

    return blob;
  }
コード例 #2
0
  private String obtenerImagenItem(long itemId) {

    String image = "";

    List<LFImage> lfImages = LFImageLocalServiceUtil.findByItemId(itemId);
    if (lfImages.isEmpty()) {
      image = "/o/lfvo-portlet/images/notFound.png";

    } else {
      for (LFImage lfImage : lfImages) {
        StringWriter writer = new StringWriter();
        writer.append("data:image/gif;base64,");
        try {
          IOUtils.copy(lfImage.getImage().getBinaryStream(), writer);
          image = writer.toString();
        } catch (IOException | SQLException e) {

        }
        break;
      }
    }

    return image;
  }