PHP Templating API: getContent()
Posted by Mark [Elevated X Support], Last modified by Mark [Elevated X Support] on 25 September 2018 01:49 PM

Description:

The getContent() function returns a list of content files (videos and movies) that are affiliated with a specific set id.

Sample Usage:

$cobj = $api->getContent(["id" => 1]);

echo "\nContent Belonging to Set Id 1:\n";
print_r($cobj->content);

Returning Attributes:

This function call will return a StdObject object with the following attribute:

content:

This is a multi-dimensional array that returns content information that belongs to the scene.

The output has a multi-level structure, as follows:

Level 1: Top level keys include the type of content that this belongs to, as determined by Types under Media Types. For instance, if this is photo content, may see a key called "highres". If this is video content, you may see a top level key called "vids".

Level 2: Underneath the first level, you will see a key that denotes the base naming for a piece of content in the system.

Examples:
- If a photo is within /members/content/upload/foldername/photos/1.jpg, the key name here would be "1"
- If a photo is within /members/content/upload/foldername/photos/photo0001.jpg, the key name here would be "photo0001"
- If a photo is within /members/content/upload/foldername/photos/IMG_4065.jpg, the key name here would be "img_0465"

The reason the system sets it up this way is so the system can group photos and medias of different types. This way, it's aware that the same piece of "content" comes in different sizes or configurations (480p, 1080p for videos, and 1024 / 1600 / 2000 for photos).

Level 3: Underneath here, you will see a key that is:
[name:type] for content that belongs to media types
AND
[thumb|watermark:type|cname] for watermark types.

Within this array you'll see all of the information available for that piece of content. This includes information such as path, filesize, and width / height.

Example print_r output of $cobj->content may look like so:
Array
(
    [highres] => Array
        (
            [img_0465] => Array
                (
                    [jpg:highres] => Array
                        (
                            [name] => jpg
                            [type] => highres
                            [filesize] => 5179688
                            [mtime] => 1505009899
                            [width] => 3024
                            [height] => 4032
                            [retina] => 0
                            [id] => 1
                            [file] => /photos/IMG_0465.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /photos/IMG_0465.jpg
                        )

                    [thumb:highres:Thumbs] => Array
                        (
                            [name] => thumb
                            [cname] => Thumbs
                            [width] => 185
                            [height] => 230
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 139865
                            [mtime] => 1505009971
                            [retina] => 1
                            [id] => 1
                            [file] => /thumbs/img_0465.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /thumbs/img_0465.jpg
                        )

                    [watermark:highres:1024] => Array
                        (
                            [name] => watermark
                            [cname] => 1024
                            [width] => 768
                            [height] => 1024
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 458891
                            [mtime] => 1505009973
                            [retina] => 0
                            [id] => 1
                            [file] => /1024watermarked/img_0465.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /1024watermarked/img_0465.jpg
                        )

                    [watermark:highres:1280] => Array
                        (
                            [name] => watermark
                            [cname] => 1280
                            [width] => 960
                            [height] => 1280
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 707668
                            [mtime] => 1505009975
                            [retina] => 0
                            [id] => 1
                            [file] => /1280watermarked/img_0465.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /1280watermarked/img_0465.jpg
                        )

                    [watermark:highres:1600] => Array
                        (
                            [name] => watermark
                            [cname] => 1600
                            [width] => 1200
                            [height] => 1600
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 1079880
                            [mtime] => 1505009978
                            [retina] => 0
                            [id] => 1
                            [file] => /1600watermarked/img_0465.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /1600watermarked/img_0465.jpg
                        )

                    [watermark:highres:Full Size] => Array
                        (
                            [name] => watermark
                            [cname] => Full Size
                            [width] => 3024
                            [height] => 4032
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 5584083
                            [mtime] => 1505009981
                            [retina] => 0
                            [id] => 1
                            [file] => /fullwatermarked/img_0465.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /fullwatermarked/img_0465.jpg
                        )

                )

            [img_0474] => Array
                (
                    [jpg:highres] => Array
                        (
                            [name] => jpg
                            [type] => highres
                            [filesize] => 1442462
                            [mtime] => 1505009897
                            [width] => 4032
                            [height] => 3024
                            [retina] => 0
                            [id] => 2
                            [file] => /photos/IMG_0474.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /photos/IMG_0474.jpg
                        )

                    [thumb:highres:Thumbs] => Array
                        (
                            [name] => thumb
                            [cname] => Thumbs
                            [width] => 185
                            [height] => 230
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 56506
                            [mtime] => 1505009972
                            [retina] => 1
                            [id] => 2
                            [file] => /thumbs/img_0474.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /thumbs/img_0474.jpg
                        )

                    [watermark:highres:1024] => Array
                        (
                            [name] => watermark
                            [cname] => 1024
                            [width] => 1024
                            [height] => 768
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 141213
                            [mtime] => 1505009974
                            [retina] => 0
                            [id] => 2
                            [file] => /1024watermarked/img_0474.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /1024watermarked/img_0474.jpg
                        )

                    [watermark:highres:1280] => Array
                        (
                            [name] => watermark
                            [cname] => 1280
                            [width] => 1280
                            [height] => 960
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 211564
                            [mtime] => 1505009976
                            [retina] => 0
                            [id] => 2
                            [file] => /1280watermarked/img_0474.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /1280watermarked/img_0474.jpg
                        )

                    [watermark:highres:1600] => Array
                        (
                            [name] => watermark
                            [cname] => 1600
                            [width] => 1600
                            [height] => 1200
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 319861
                            [mtime] => 1505009979
                            [retina] => 0
                            [id] => 2
                            [file] => /1600watermarked/img_0474.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /1600watermarked/img_0474.jpg
                        )

                    [watermark:highres:Full Size] => Array
                        (
                            [name] => watermark
                            [cname] => Full Size
                            [width] => 4032
                            [height] => 3024
                            [sourcetype] => highres
                            [type] => 
                            [filesize] => 1540239
                            [mtime] => 1505009984
                            [retina] => 0
                            [id] => 2
                            [file] => /fullwatermarked/img_0474.jpg
                            [show] => 1
                            [date] => 09/09/2017
                            [fullpath] => /fullwatermarked/img_0474.jpg
                        )

                )

        )

)

Arguments:

id:

This retrieves content that belongs to the specified set id.

Note: This is a required attribute.


(0 vote(s))
Helpful
Not helpful

Comments (0)