Page 1 of 1

Embedding pictures in pedia articles

Posted: Sat Oct 01, 2016 9:22 pm
by Sloth
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?

Re: Embedding pictures in pedia articles

Posted: Sat Oct 01, 2016 9:42 pm
by MatGB
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.

Re: Embedding pictures in pedia articles

Posted: Sun Oct 02, 2016 12:11 am
by xlightwavex
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".

Re: Embedding pictures in pedia articles

Posted: Sun Oct 02, 2016 10:50 am
by Sloth
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.