1
14
15 package com.liferay.portal.model.impl;
16
17 import com.liferay.portal.image.Hook;
18 import com.liferay.portal.image.HookFactory;
19 import com.liferay.portal.kernel.log.Log;
20 import com.liferay.portal.kernel.log.LogFactoryUtil;
21 import com.liferay.portal.kernel.util.Base64;
22 import com.liferay.portal.model.Image;
23
24
29 public class ImageImpl extends ImageModelImpl implements Image {
30
31 public ImageImpl() {
32 }
33
34 public byte[] getTextObj() {
35 if (_textObj == null) {
36 try {
37 Hook hook = HookFactory.getInstance();
38
39 _textObj = hook.getImageAsBytes(this);
40 }
41 catch (Exception e) {
42 _log.error("Error reading image " + getImageId(), e);
43 }
44 }
45
46 return _textObj;
47 }
48
49 public void setTextObj(byte[] textObj) {
50 _textObj = textObj;
51
52 super.setText(Base64.objectToString(textObj));
53 }
54
55 private byte[] _textObj;
56
57 private static Log _log = LogFactoryUtil.getLog(ImageImpl.class);
58
59 }