留言板

Image Gallery and IFrame

thumbnail
Joseph Wolfe,修改在10 年前。

Image Gallery and IFrame

Regular Member 帖子: 103 加入日期: 11-2-22 最近的帖子
Need to know if it is possible to force the Image Gallery to keep an image URL the same so that when editing an image the changed image will always appear in the IFrame portlet.

For example:

I upload an image to Image Gallery named "image1" and the assigned URL is .../image/image_gallery?uuid=250. Now I edit that image and upload a different image. I need the URL to remain the same so that the URL that is hardcoded in the IFrame portlet will always display the edited image. I have a user who needs to upload a new image every day and this method would be good if it is possible.

Thanks
thumbnail
Bart Simpson,修改在10 年前。

RE: Image Gallery and IFrame

Liferay Master 帖子: 522 加入日期: 11-8-29 最近的帖子
As an alternative.
If you already know what image (eg. a user's profile image etc) is uploaded you could try reading it and generating the url through the api. Then then url can be programatically placed a the source in iframe .
thumbnail
Joseph Wolfe,修改在10 年前。

RE: Image Gallery and IFrame

Regular Member 帖子: 103 加入日期: 11-2-22 最近的帖子
Bart Simpson:
As an alternative.
If you already know what image (eg. a user's profile image etc) is uploaded you could try reading it and generating the url through the api. Then then url can be programatically placed a the source in iframe .


Thanks for the reply - if you happen to have a chance could you elaborate a bit more on this? I am not quite savvy enough at this time to just pick it all up.

Thanks!
thumbnail
Vilmos Papp,修改在10 年前。

RE: Image Gallery and IFrame

Liferay Master 帖子: 529 加入日期: 10-10-21 最近的帖子
If you are on 6.1 and upload your images to Documents and Media, then if you take the Download URL from the image's context menu for example and you trim the ?t=1234165467 value from it.

You will have something like this: http://localhost:8080/documents/10328/0/test.png/6dcd7428-9fb3-40b7-a165-04d1a5320e3c?t=1367499746752

From the above URL you see, that the file (test.png is uploaded to : /@group_id@/@folder_id@/file_name/@uuid@.

As @group_id@ and @folder_id@ are for locating the folder and file, they don't affect your results, and as you update the image, you use the original file_name, so that will be still constant you should verify only the UUID value in your DB. Honestly, I think it's the same for each version of your file (version automatically increases when you edit your file's record) so the final conclusion is that with this URL you can safely link to your latest version of the image (if you leave the ?t= part in the URL, it could retreave older version from cache in some circumstenses)

If you want to retreive a specific version of the file, you can add a "version" parameter to the URL like: http://localhost:8080/documents/10328/0/upload_00004535.png/6dcd7428-9fb3-40b7-a165-04d1a5320e3c?version=1.1
thumbnail
Joseph Wolfe,修改在10 年前。

RE: Image Gallery and IFrame

Regular Member 帖子: 103 加入日期: 11-2-22 最近的帖子
I am on 6.0.....are there differences due to that fact?
thx
thumbnail
Vilmos Papp,修改在10 年前。

RE: Image Gallery and IFrame

Liferay Master 帖子: 529 加入日期: 10-10-21 最近的帖子
I think there shouldn't be any differences regarding to uuid handling, but the structure of the URL could be different.

So I suggest you check the URL format for one of your images and check whether the URL works with UUID, if so, verifiy that if you update your image, than both the 1.0 and 1.1 version has the exaclty same UUID.
thumbnail
Joseph Wolfe,修改在10 年前。

RE: Image Gallery and IFrame

Regular Member 帖子: 103 加入日期: 11-2-22 最近的帖子
This worked as intended. Thanks for your assistance. emoticon
thumbnail
Vilmos Papp,修改在10 年前。

RE: Image Gallery and IFrame

Liferay Master 帖子: 529 加入日期: 10-10-21 最近的帖子
You're welcome emoticon