Image path expected to change with category

Having trouble installing serendipity?
Post Reply
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Image path expected to change with category

Post by bebr »

An image was uploaded to mydomain.de/us/uploads/image.jpg and inserted in an entry - and shows up fine in the blog.

Then I assigned the entry to an existing category - and the image disappears. - The reason is that its URL now points to mydomain.de/us/categs/uploads/image.jpg

So it seems "categs/" is added to the image path if an entry is assigned to a category. What is the idea behind this? How can one overcome this issue, i.e. use one image file/path for all possible applications?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Image path expected to change with category

Post by garvinhicking »

Hi!

Hm, that is strange, this shouldn't happen. Could it be related to your WYSIWYG editor? Does it happen too if you use th internal WYSIWYG editor or if you turn of the wysiwyg editor temporarily?

Changing the category association does not make serendipity change anything WITHIN the content. So it must be the editor that's screwing around...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Post by bebr »

The workflow is:
1. Visitor views the blog homepage with two articles -> picture is there.
2. Clicks on the first entry title -> entry appears alone -> picture is there.
3. Clicks on the category the entry is assigned to -> entry appears -> picture disappears (title text is shown).
(The same happens when one omits the step 2.)

So how could the editor interfere here? The user in this test does not even have the right to edit.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

You must enter your links in entries with a ABSOLUTE URL. Your editor seems to insert relative links, which of course don'T work if you view a category, where the "URL" of an entry is different.

Instead of <img src="upload/x.img"> your HTML code must contain <img src="/upload/x.img">. The HTMLArea component takes usually care of that, does TinyMCE not do that properly?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Post by bebr »

Ok, if one enters an absolute URL into the "image URL" field (that pops up in tinyMCE) it gets translated and inserted in the entry's HTML as a relative URL.

Haven't found a hint in the tinyMCE documentation wiki on how to change this behaviour.
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Post by bebr »

Here is a solution:
sy-home> mkdir categs
sy-home> cd categs
sy-home/categs> ln -s ../uploads/ uploads

Rather a hack, but it does the job for the moment.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Then also remember to create symbolic links for:

archives/
archives/2007
archives/2007/07
archives/2007/07/C1

etc. - for every virtual directory you will need a symbolic link. So you'll need hundreds of symbolic links.

What I want to say:This is not a good hack. You should instead try to find a possiblity to make your editor not insert a relative URL! The htmlarea component does that, I thought other components like fckedit should also do that? Maybe there's a tinymce configuration option to allow relative links?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Post by bebr »

You know that tinyMCE is not "my" editor :wink:
Found no hints on relative image URLs in tinymce docs .. so far.

So then I spent some time trying to get FCKeditor to work with
a) user defined styles from templates/mytmpl/style.css
b) images from the /uploads (or another chosen) folder

and failed with both: a) The path for style.css put into fckconfig.js is not recognized, b) fck expects some "/images" folder and I was not able to change this.
BTW, I'd love to use just HTMLarea if it was able to use my styles.
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Post by bebr »

Found something better than a hack, more like a solution:
http://wiki.moxiecode.com/index.php/Tin ... nvert_urls

Setting this to 'false' in
plugins/serendipity_event_tinymce/serendipity_event_tinymce.php

stops tinyMCE from "being clever" and converting absolute URLs.
Now after deleting the symbolic links the pics are all there.

Sooner or later I'll try to activate the magic iManager that the plugin config mentions:
http://www.j-cons.com/news/more.php?id=159_0_1_0_C
Post Reply