Opened 7 years ago

Closed 3 years ago

# Images can't be found

Reported by: Owned by: Ben Allen Ryan J Ollos normal CodeExampleMacro normal Ryan J Ollos 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.

### comment:1 Changed 7 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 4 years ago by Ryan J Ollos

Owner: changed from Alexander Slesarev to Ryan J Ollos new → assigned

### comment:4 Changed 3 years ago by Ryan J Ollos

Resolution: → fixed assigned → 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.

### Modify Ticket

Change Properties