On Jul 6, 2010, at 3:32 PM, Suraj wrote: > Hi, > > I'm not sure how to use LinkUtil to retrieve the image links? I have tried to > use LinkUtil.convertLinksFromUUIDPattern() on the text retrieved from a page > but that does not seem to be working. What I would like to do is scan the > whole page and, where it finds images, convert them to an absolute URL and > return the text with the links resolved. Is this possible?
Yes it is possible, but you have to understand what you are feeding into the transformer. There are few different kinds of links in Magnolia - links in the rich text (fckEdit control) - path based links (link control) - uuid based links (uuidLink control) The LinkUtil.convertLinksFromUUIDPattern() is meant for parsing the links in text from fckEdit. You can provide the specific transformer to the method to ensure the links it will output will be in the correct format. However it will not spit out the collection of URLs for you. Call will merely replace all occurences of uuidlink pattern with the absolute or relative links (depending on the transformer you pass in). For the other 2 types of links, you can use LinkFactory.parseLink and/or LinkFactory.parseUuidLink to create a Link object which you can then feed directly to the transformer of choice. HTH, Jan > > From: Grégory Joseph <[email protected]> > To: Magnolia User-List <[email protected]> > Sent: Tue, 6 July, 2010 12:43:36 > Subject: Re: [magnolia-user] Convert images to links? > > Hi Suraj, > > From: Suraj [mailto:[email protected]] > To: [email protected] > Sent: Tue, 06 Jul 2010 13:03:59 +0200 > Subject: [magnolia-user] Convert images to links? > > > I am writing a class which retrieves all the content from a particular page > and outputs the content to an external XML file. If the page has images > (either uploaded or from the dms), how could I retrieve the URL of the image? > > I came across info.magnolia.cms.link.LinkResolverImpl but I notice its been > deprecated since 4.0... > Indeed it is, and the deprecation note also encourages you to use > info.magnolia.link.LinkUtil instead ;-) > > hth, > > -g > > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <[email protected]> > ---------------------------------------------------------------- > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <[email protected]> > ---------------------------------------------------------------- ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
