Modify

Opened 4 years ago

Closed 8 weeks ago

#8331 closed defect (fixed)

Images can't be found

Reported by: AllenB Owned by: rjollos
Priority: normal Component: CodeExampleMacro
Severity: normal Keywords:
Cc: rjollos Trac Release: 0.12

Description

I am running Trac 0.12 and whenever I try to load a wiki page containing a CodeExample macro, I get "404 Not Found" errors in the Trac log for button-expand.gif, etc. Also, when viewing the WikiMacros page, the section showing details for the [[CodeExample]] macro shows broken links in place of the sample screenshots.

I discovered that the images in the htdocs/img directory aren't being included in the egg. I made the following change to setup.py to partially address this problem. Change the lines

package_data={'codeexample': ['templates/*.html', 'htdocs/css/*.css',
                                  'htdocs/js/*.js']},

to

package_data={'codeexample': ['templates/*.html', 'htdocs/css/*.css',
                                  'htdocs/js/*.js', 'htdocs/img/*.gif', 'htdocs/img/*.png']},

and the "404 Not Found" errors on the .gif files will no longer be seen. Manually inspecting the egg cache confirms that the .gif and .png images are now being included in the egg file as expected.

However, I am still seeing bad image links being generated on the WikiMacros page. The bad image URL that is generated looks like http://127.0.0.1/chrome/ce/img/example1.png when the desired image is instead located at http://127.0.0.1/ProjectName/chrome/ce/img/example1.png.

Attachments (0)

Change History (4)

comment:1 Changed 4 years ago by rjollos

  • Cc rjollos added

comment:2 Changed 3 years ago by ilewismsl

The problem with the WikiMacros page display comes from the double slashes in the Image() macro invocations.

For example:

  [[Image(//chrome/ce/img/example1.png)]]

should be

  [[Image(/chrome/ce/img/example1.png)]]

That is, the path should be environment relative, not server relative.

For all but Example4, I recommend replacing the image with the actual macro invocation. It gives the user a real example, not just a dummy one.

Example4 needs an image or include no example display since it is designed to access a repository and it cannot know where to find anything on any given system.

comment:3 Changed 9 months ago by rjollos

  • Owner changed from nuald to rjollos
  • Status changed from new to assigned

comment:4 Changed 8 weeks ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

In 14039:

1.2: Include images in egg and fixed links to sample screenshots. Fixes #8331.

Thanks to AllenB and ilewismsl for the patches.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.