Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Joseph Wolfe
Image Gallery and IFrame
30. April 2013 09:14
Antwort

Joseph Wolfe

Rang: Regular Member

Nachrichten: 102

Eintrittsdatum: 22. Februar 2011

Neue Beiträge

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
Bart Simpson
RE: Image Gallery and IFrame
1. Mai 2013 00:19
Antwort

Bart Simpson

Rang: Liferay Master

Nachrichten: 523

Eintrittsdatum: 29. August 2011

Neue Beiträge

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 .
Joseph Wolfe
RE: Image Gallery and IFrame
2. Mai 2013 05:25
Antwort

Joseph Wolfe

Rang: Regular Member

Nachrichten: 102

Eintrittsdatum: 22. Februar 2011

Neue Beiträge

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!
Vilmos Papp
RE: Image Gallery and IFrame
2. Mai 2013 06:13
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Expert

Nachrichten: 425

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

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
Joseph Wolfe
RE: Image Gallery and IFrame
2. Mai 2013 06:36
Antwort

Joseph Wolfe

Rang: Regular Member

Nachrichten: 102

Eintrittsdatum: 22. Februar 2011

Neue Beiträge

I am on 6.0.....are there differences due to that fact?
thx
Vilmos Papp
RE: Image Gallery and IFrame
2. Mai 2013 07:32
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Expert

Nachrichten: 425

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

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.
Joseph Wolfe
RE: Image Gallery and IFrame
2. Mai 2013 11:20
Antwort

Joseph Wolfe

Rang: Regular Member

Nachrichten: 102

Eintrittsdatum: 22. Februar 2011

Neue Beiträge

This worked as intended. Thanks for your assistance. emoticon
Vilmos Papp
RE: Image Gallery and IFrame
3. Mai 2013 01:16
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Expert

Nachrichten: 425

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

You're welcome emoticon