Embedding pictures in pedia articles

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderator: Committer

Post Reply
Message
Author
User avatar
Sloth
Content Scripter
Posts: 685
Joined: Sat Mar 17, 2007 12:28 am

Embedding pictures in pedia articles

#1 Post by Sloth » Sat Oct 01, 2016 9:22 pm

I recently remembered that it should be possible to embed pictures in pedia articles, but my attempts so far failed.

I tried to copy the hard coded embedded picture in the suitability report (EncyclopediaDetailPanel.cpp):

Code: Select all

detailed_description += UserString("ENC_SUITABILITY_REPORT_WHEEL_INTRO") + "<img src=\"encyclopedia/EP_wheel.png\"></img>";
but when i add the same picture to the end of a pedia article the picture is not found and the red X is displayed.

Code: Select all

ENVIRONMENT_TEXT
'''Different environments can be encountered when exploring the planetary systems on the galactic map: [[PT_INFERNO]], [[PT_RADIATED]], [[PT_TOXIC]], [[PT_BARREN]], [[PT_DESERT]], [[PT_TUNDRA]], [[PT_SWAMP]], [[PT_TERRAN]], [[PT_OCEAN]], [[PT_ASTEROIDS]], and [[PT_GASGIANT]].

Each [[encyclopedia ENC_SPECIES]] has its own environmental preferences, which determine on each planet type the suitability for the species, according to the following list (from worst to best):

[[PE_UNINHABITABLE]] < [[PE_HOSTILE]] < [[PE_POOR]] < [[PE_ADEQUATE]] < [[PE_GOOD]]

The planet suitability report can be displayed by right-cliking on a planet in the system sidepanel. A green number following the suitability data indicates the max population value if the species colonizes the planet, whereas a red number indicates that the population will stay idle or will decrease, to finally perish if the species attempts to colonize the planet.

When terraforming a planet (by [[encyclopedia RESEARCH_TITLE]] or if the planet has the [[special GAIA_SPECIAL]] special) in order to better suit the species environmental preferences, the planet's original environment is modified by stages, until it finally reaches the [[PE_GOOD]] suitability for the species who wants to live on the planet. The terraforming stages can be checked on the suitability wheel displayed in the Planet Suitability report.
<img src=\"encyclopedia/EP_wheel.png\"></img>'''
The error message is also attached. Can somebody help me?
Attachments
error.png
error.png (4.55 KiB) Viewed 411 times
environment.png
environment.png (69.33 KiB) Viewed 411 times
All released under the GNU GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0 licences.

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Embedding pictures in pedia articles

#2 Post by MatGB » Sat Oct 01, 2016 9:42 pm

Ah, it's hardcoded into the backend C++ code, that why I could never figure out images.

OK, pure guess, the backend has escaped the file source, try

Code: Select all

<img src="encyclopedia/EP_wheel.png"></img>
, but it's a pure guess, I would love to know how to embed images directly throught the Pedia but I never got around to chasing up how to do it.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

xlightwavex
Space Kraken
Posts: 111
Joined: Mon Nov 16, 2015 5:57 am

Re: Embedding pictures in pedia articles

#3 Post by xlightwavex » Sun Oct 02, 2016 12:11 am

Though im new here and dunno exactly if you figured this out or not.

I wanted to point out that your actual error states, that you have passed a folder directory and didn't actually pass in the file name of the image to load within the path given.

Image

non-file path typically means a directory or folder path without the filename at the end.

E.G. somepicture.png is missing

the error says you passed

"../../art/"

instead of the below which its implying it requires.

"../../art/somepicture.png"

The error msg probably should assert "a filename is required within the given path specified".

User avatar
Sloth
Content Scripter
Posts: 685
Joined: Sat Mar 17, 2007 12:28 am

Re: Embedding pictures in pedia articles

#4 Post by Sloth » Sun Oct 02, 2016 10:50 am

MatGB wrote:OK, pure guess, the backend has escaped the file source, try

Code: Select all

<img src="encyclopedia/EP_wheel.png"></img>
, but it's a pure guess, I would love to know how to embed images directly throught the Pedia but I never got around to chasing up how to do it.
That worked! Thanks Matt.
All released under the GNU GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0 licences.

Post Reply