001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.image.HookFactory;
018 import com.liferay.portal.kernel.image.Hook;
019 import com.liferay.portal.kernel.log.Log;
020 import com.liferay.portal.kernel.log.LogFactoryUtil;
021 import com.liferay.portal.kernel.util.Base64;
022 import com.liferay.portal.model.Image;
023
024
027 public class ImageImpl extends ImageModelImpl implements Image {
028
029 public ImageImpl() {
030 }
031
032 public byte[] getTextObj() {
033 if (_textObj == null) {
034 try {
035 Hook hook = HookFactory.getInstance();
036
037 _textObj = hook.getImageAsBytes(this);
038 }
039 catch (Exception e) {
040 _log.error("Error reading image " + getImageId(), e);
041 }
042 }
043
044 return _textObj;
045 }
046
047 public void setTextObj(byte[] textObj) {
048 _textObj = textObj;
049
050 super.setText(Base64.objectToString(textObj));
051 }
052
053 private byte[] _textObj;
054
055 private static Log _log = LogFactoryUtil.getLog(ImageImpl.class);
056
057 }