Photogallery First project in OOP review Please take it easy on my as this is my first OOP web application I plan on converting it to some deeper degree but not sure yet.

The basic functionality is there I think, but I'm looking for some feedback on how I can improve this in terms of OOP and simplicity. Sorry for any simple mistakes only been doing php for a few months and its my first language :)

Many Thanks

&lt;?php

class Image{

/*
*list of properties 
*image filepath gets pasted in $imageFilepath
*/
public $imageFilepath = "";
public $imageTitle;
public $imageSize;

/*
*list of properties 
*image filepath gets pasted in $imageFilepath
*/
public function __construct() {
     echo 'Welcome to Dannys awesome Gallery';  
}

/*
*function to get the image filepath, runs through the files the outputs then in an array
*
*/

public function getimage_Filepath() {
    $image_files = get_files($imageFilepath);
    if (count($image_files)) {
        $index = 0;
        foreach($image_files as $index=&gt;$file)
        $index++;   
    }
    return;
}

/*
*Outputs the file images found
*
*/

public function setimage_Filepath() {
    echo $this-&gt;getimage_Filepath();
}

/*
*Generates the image name, from the actual filename
*
*/

public function getimage_title($imageTitle) {
//gets the image title using basename 
    $imageTitle = $this-&gt;imageFilepath;
    basename($imageTitle);
    return $imageTitle;
}

/*
*Outputs the image name 
*
*/

public function setimage_title($imageTitle) {
    //displays the image title
    echo $this-&gt;imageTitle;
}

}
$image = new Image;
?&gt;
The code below is good. I only changed the comments a bit to make them a bit clearer and more concise. However, 
one glaring issue is that it seems you have your setters and getters mixed up. Note the getimage_*() 
and setimage_*() functions you have in your class. Usually, setter and getter functions do exactly that: 
they set a value and get a value. What you seem to be doing is using the set* functions to get the 
value returned by another function. This is +wrong+. 

&lt;?php

class Image{
    public $imageFilepath = "";
    public $imageTitle;
    public $imageSize;

    /**
     * Construct
     */
    public function __construct() {
         echo 'Welcome to Dannys awesome Gallery';  
    }

    /**
     * Get image filepath
     *
     * @return array
     */
    public function getimage_Filepath() {
        $image_files = get_files($imageFilepath);
        if (count($image_files)) {
            $index = 0;
            foreach($image_files as $index=&gt;$file)
            $index++;   
        }
        return;
    }


    /**
     * Output tile image found
     *
     * @return array
     */
    public function setimage_Filepath() {
        echo $this-&gt;getimage_Filepath();
    }


    /**
     * Generate image name derived from filename
     *
     * @return string
     */
    public function getimage_title($imageTitle) {
        //gets the image title using basename 
        $imageTitle = $this-&gt;imageFilepath;
        basename($imageTitle);
        return $imageTitle;
    }

    /**
     * Output the image name
     *
     * @return string
     */
    public function setimage_title($imageTitle) {
        //displays the image title
        echo $this-&gt;imageTitle;
    }
}
?&gt;


Now, let's get rid of the set* functions: 

&lt;?php

class Image{
    public $imageFilepath = "";
    public $imageTitle;
    public $imageSize;

    /**
     * Construct
     */
    public function __construct() {
         echo 'Welcome to Dannys awesome Gallery';  
    }

    /**
     * Get image filepath
     *
     * @return array
     */
    public function getimage_Filepath() {
        $image_files = get_files($imageFilepath);
        if (count($image_files)) {
            $index = 0;
            foreach($image_files as $index=&gt;$file)
            $index++;   
        }
        return;
    }


    /**
     * Generate image name derived from filename
     *
     * @return string
     */
    public function getimage_title($imageTitle) {
        //gets the image title using basename 
        $imageTitle = $this-&gt;imageFilepath;
        basename($imageTitle);
        return $imageTitle;
    }
}
?&gt;


Great! Looking much better. Now, remember that your construct should be used to set variables or initialize
functions that the object requires - NOT echoing something out (unless its an Exception, in which case you'd
use throw new Exception('')). So let's move the echo OUT of the class, initialize the $imageFilepath 
variable:

&lt;?php

class Image{
    private $imageFilepath;
    private $imageTitle;
    private $imageSize;

    /**
     * Construct
     */
    public function __construct(string $imageFilepath) {
        if(empty($imageFilepath)){
            throw new Exception("Expecting image file path, nothing given.");
        } else {
            $this-&gt;imageFilepath = $imageFilepath;
        }
    }

    /**
     * Get image filepath
     *
     * @return array
     */
    public function getImageFilepath() {
        return $this-&gt;imageFilepath;
    }

    /**
     * Get the files in a directory pointed by imageFilepath
     * 
     * @return array
     */
    public function getFilesInFilepath(){
        $directoryContent = scandir($this-&gt;imageFilepath);
        foreach($directoryContent as $key =&gt; $value){
            $path = $this-&gt;imageFilepath . PATH_SEPARATOR . $value;
            if(is_file($path) &amp;&amp; is_readable($path)){
                $files[] = $path;
            }
        }
        return $files;
    }


    /**
     * Generate image name derived from filename
     *
     * @return highlight_string(str)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     */
    public function getImageTitle(string $imageFile) {
        return basename($imageFile);
    }
}

// We initialize the object and set the imageFilepath at the same time
$image = new Image("/home/jsanc623/Pictures/");

// We can get the image filepath
$imageFilepath = $image-&gt;getImageFilepath();

// We can get an array of all the files in a directory
$filesInFilePath = $image-&gt;getFilesInFilepath();

// We can then get the image titles for each image/
foreach($filesInFilePath as file){
    $imageTitle[] = $image-&gt;getImageTitle($file);
}

print_r($imageTitle)
?&gt;