Package com.liferay.portal.model

Examples of com.liferay.portal.model.Image


    if (uploadedFileId == null) {

      try {

        long imageId = user.getPortraitId();
        Image image = ImageServiceUtil.getImage(imageId);
        setContentType(image.getType());
        byteArray = image.getTextObj();
      }
      catch (Exception e) {

        logger.error(e);
        throw new IOException(e.getMessage());
View Full Code Here


    ImageUtil.remove(imageId);
  }

  public Image getImage(String imageId) throws SystemException {
    Image image = null;

    try {
      image = ImageUtil.findByPrimaryKey(imageId);
    }
    catch (NoSuchImageException nsie) {
      image = ImageUtil.create(imageId);

      image.setTextObj(ImageLocalUtil.getDefaultBytes());

      ImageUtil.update(image);
    }

    return image;
View Full Code Here

  }

  public Image updateImage(String imageId, byte[] bytes)
    throws SystemException {

    Image image = null;

    try {
      image = ImageUtil.findByPrimaryKey(imageId);
    }
    catch (NoSuchImageException nsie) {
      image = ImageUtil.create(imageId);

      image.setTextObj(ImageLocalUtil.getDefaultBytes());

      ImageUtil.update(image);
    }

    image.setTextObj(bytes);

    ImageUtil.update(image);

    return image;
  }
View Full Code Here

                 * getString() method is called on a LONG field on an Oracle database. Because of this,
                 * the object is loaded from liferay and DotConnect is not used
                 * http://jira.dotmarketing.net/browse/DOTCMS-1911
                 */
                for (int j = 0; j < l.size(); j++) {
                    Image im = (Image)l.get(j);
                    DotConnect dc = new DotConnect();
                    dc.setSQL("insert into image values (?,?)");
                    if(!UtilMethods.isSet(im.getImageId()) && DbConnectionFactory.isOracle()){
                        continue;
                    }
                    dc.addParam(im.getImageId());
                    dc.addParam(im.getText());
                    dc.getResults();
                }
            }else if(portlet){
                for (int j = 0; j < l.size(); j++) {
                    HashMap<String, String> dcResults = (HashMap<String,String>)l.get(j);
View Full Code Here

      }
      else {
        newImageId = newImageId + ".large";
      }

      Image image = ImageManagerUtil.getImage(oldImageId);

      ImageManagerUtil.updateImage(newImageId, image.getTextObj());
      ImageManagerUtil.deleteImage(oldImageId);
    }

    // Shopping Item

    itr = ImageManagerUtil.getImageIds("%.s.%").iterator();

    while (itr.hasNext()) {
      String oldImageId = (String)itr.next();

      String newImageId = StringUtil.replace(
        oldImageId, ".s.", ".shopping.item.");

      Image image = ImageManagerUtil.getImage(oldImageId);

      ImageManagerUtil.updateImage(newImageId, image.getTextObj());
      ImageManagerUtil.deleteImage(oldImageId);
    }
  }
View Full Code Here

          imageId += ".large";
        }
      }
    }

    Image image = ImageLocalUtil.get(imageId);

    if (Validator.isNull(imageId)) {
      _log.error(
        "Image id should never be null or empty, path is " +
          req.getPathInfo());
    }

    if (image == null) {
      _log.error("Image should never be null");
    }
    else {
      if (Validator.isNotNull(image.getType())) {
        res.setContentType("image/" + image.getType());
      }

      /*res.setHeader(
        "Cache-control", "max-age=" + Long.toString(Time.WEEK));*/

      try {
        if (!res.isCommitted()) {
          ServletOutputStream out = res.getOutputStream();

          out.write(image.getTextObj());
          out.flush();
        }
      }
      catch (Exception e) {
        Logger.error(this,e.getMessage(),e);
View Full Code Here

    }
    else if (imageId == null) {
      return null;
    }
    else {
      Image obj = null;
      String key = imageId.toString();

      if (Validator.isNull(key)) {
        return null;
      }
View Full Code Here

    }
    else if (imageId == null) {
      return null;
    }
    else {
      Image obj = null;
      String key = imageId.toString();

      if (Validator.isNull(key)) {
        return null;
      }
View Full Code Here

public class ImageLocalUtil {

  public static Image get(String id) {
    ImageLocalUtil imageLocalUtil = _getInstance();

    Image image = imageLocalUtil._get(id);

    if (image == null) {
      try {
        image = ImageManagerUtil.getImage(id);
      }
View Full Code Here

  public static void put(String id, byte[] bytes) {
    ImageLocalUtil imageLocalUtil = _getInstance();

    ImageKey.generateNewKey(id);

    Image image = null;

    try {
      image = ImageManagerUtil.updateImage(id, bytes);
    }
    catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.liferay.portal.model.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.