I have been using to get my files
<?php include 'example.html'; ?>
however how do you get them if they are in a subfolder: For example
pictures/example.html
I have been using to get my files
<?php include 'example.html'; ?>
however how do you get them if they are in a subfolder: For example
pictures/example.html
The best practice for this is to define a ABSOLUTE_PATH constant that contains the directory that everything is located under. After that, you can simply copy and paste everything, because it is defining the 'full' path, which doesn't change from directory to directory.
E.g
define("ABS_PATH", $_SERVER['DOCUMENT_ROOT']);
or
define("ABS_PATH", dirname(__FILE__));
// This defines the path as the directory the file is in.
Then at any point you can simply do this to include a file
include(ABS_PATH . "/path/to/file");
$_SERVER: It returns "The document root directory under which the current script is executing, as defined in the server's configuration file.", so in some cases might not be entirely what you'd expect it to beIf it were a source file, you could do:
include __DIR__ . '/pictures/src.php';
But because you're dealing with a binary file (raw data, ones and zeros) you may want to use the image library:
$resource = imagecreatefromjpeg( string $filename );
See http://www.php.net/manual/en/function.imagecreatefromjpeg.php
Or, if you just want the bytes, use:
$contents = file_get_contents(__DIR__ . '/pictures/src.php');