Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Odd image import issue

Hi all, new twine user...

I am using twine 1.4.2 and Sugarcube 2.

I'm attempting to link to an image in a subfolder.

Game is being saved / written from D:\Test Game

Test game folder has a subfolder named fa_images

fa_images has a subfolder named Family, which contains the images.

The syntax for the linkage i'm using is: <<if $OptionImages>>[img[fa_images/family/jane.jpg]]<<endif>>

When i save my passage, i get the following error:

IOError: [Errno 2] No such file or directory: u'D:\\Test Game\\fa_images/family/jane.jpg]]<<enddif>>

I *think* the problem is the " u' " in front of the D:\\... But i'm not sure where that is coming from.

Here is the full error, if needed:
img

Comments

  • The u in front of the String value indicates that it is a Unicode String, which is a extend String type that supports [url="http://unicode-table.com/en/]Unicode Characters[/url].

    First a little background about folder/file names, web-based things, and operating systems.

    Some operating systems (like Windows) are generally case-insensitive when it comes to folder/file names, so if you have folder named "Family" and try to reference it as "family" in a URL then it will generally not have a problem finding it even thought one has a uppercase F and the other a lower case f.

    Some operating systems (like any of the unix/linux based ones) are case-sensitive when it comes to folder/file names, it this case it will consider "Family" and "family" as two different folders.

    There is a similar issue when handling space characters in folder/file names.

    Because the above issues can seriously effect web-based things as a general rule all letters in folder/file names should be the same case (generally lowercase because it is quieter *smile*) and all space characters should replaced with either a keyboard dash '-' or a keyboard underscore '_' character or removed.

    So your file structure would become either:
    test_game
    	fa_images
    		family
    			jane.jpg
    
    or
    
    test-game
    	fa-images
    		family
    			jane.jpg
    
    
    ... it generally helps to be consistent with using either of the keyboard dash '-' or underscore '_' characters.

    WARNING: Always use the dash and underscore characters found on your keyboard in folder/file names and not the extended equivalents, as using the extended characters can cause issues on some operating systems/web-servers.
  • Do you need the path to be that complex?

    Unless you have hundreds of images, it'd be simpler and less error-prone to just use a simple "images" folder.
  • Thank you!~
Sign In or Register to comment.