Modify

Opened 6 years ago

Closed 3 years ago

#8331 closed defect (fixed)

Images can't be found

Reported by: Ben Allen Owned by: Ryan J Ollos
Priority: normal Component: CodeExampleMacro
Severity: normal Keywords:
Cc: Ryan J Ollos 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 6 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:2 Changed 5 years ago by Ian Lewis

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 3 years ago by Ryan J Ollos

Owner: changed from Alexander Slesarev to Ryan J Ollos
Status: newassigned

comment:4 Changed 3 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

In 14039:

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

Thanks to AllenB and ilewismsl for the patches.

Modify Ticket

Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.