Forum OpenACS Q&A: Content Repository/CMS

Collapse
Posted by Gilbert Wong on
I'm trying to use the Content Repository/CMS to store html pages with
pictures.  The goal is to let the page author write the page in a
program like FrontPage (or vi =P) and upload them to the content
repository using a web form.  The pictures will also be stored in the
content repository.

The major roadblock I am hitting is that if the page author uses the
IMG tag with relative links to a picture in the development system
(ie the Author's work directory), when the author uploads it, I don't
see an obvious way to link the picture in the content repository to
the IMG tag link in the article HTML code.

I read through the content repository documentation to see if I could
get any ideas, but I couldn't find anything helpful.

Does anyone have a suggestion?  Thanks.

Collapse
Posted by Dan Wickstrom on
I don't recall that there was any documentation on this, but after some trial and error while debugging the cms, I think I understand how it works now.

First thing, you need to go to the cms interface and upload an image into the CR. Next associate a template with the image, and make the new revision the live revision. For testing, I've been making a default template that I use for both basic content items and images. It looks like the following:

<html><body><content></body></html>
Next you need to access the image through its virtual url. If cms is mounted at http://yourmachine/cms, then you can access the image at http://yourmachine/cms/item2976 (assuming item2976 corresponds to the image that you uploaded). Once you do that the image gets published to the file-system, so you can now go to [openacs root]/www to view the image from the file-system. Depending on whether the image is a gif or a jpg, the appropriate extension will be appended to the name. So you will see something like item2976.jpg in the [openacs root]/www directory.

Once you've done all that, you can now reference the images in your content items using a relative url:

	<img src=/item2976.jpg>

There are some problems with doing it this way, because each time you change the image you need to make sure and go to the virtual url and access it or it won't get published to the file-system. If, you're not worried about accessing content with something like frontpage,then it is simpler, because you can use the virtual url for the image in your content items, and you won't have to worry about the revised image being published to the file system. Just use an img tag like the following:

	<img src=/item2976>
Collapse
Posted by Gilbert Wong on
Hi Dan,

I came up with the same method.  However, I wanted to preserve the image name so that the author would not have to modify the code to fix every html image tag to reference the correct content item.

hmmm... Maybe I'll do a regsub of the HTML code when the images are uploaded.  I need to think about this some more.

Thanks again.

Collapse
Posted by Dan Wickstrom on
Well then when you create the image as a content item give it the same name as the image that you're uploading - except leave off the extension.  Then you'll be able to access the image by its original name.
Collapse
Posted by Rocael Hernández Rizzardini on
Gilbert, have you resolved this problem? Now we want to implement something like this.

You are talking about Ybos ported CMS?

Maybe we can collaborate.

Collapse
Posted by Gilbert Wong on
Well, it's the CMS that Dan and Roberto worked on which is in the CVS repository.  I won't have a chance to explore this until the weekend.  I have some ideas and yes, we should collaborate.  We can take this offline.