Fields (properties) of a class are, in fact, ordinary variables, with only nuances in terms of scope.
If you suddenly know how to "assign a picture to a variable", then with the class properties your method will work the same way. It was a lyrical digression.
Now about the "picture". “Picture”, in this context, is an ooooooooooooooochen broad concept by which almost anything can be understood, for example:
- A set of bytes representing the image in bmp format.
- .... jpg
... and there are hundreds of raster formats ...
- Maybe this SVG vector image
... send vector formats ...
- Or is it just the name of the image file on the local filesystem?
- Relative URL to the site
- URL to another site
- Or is it generally ASCII graphics?
etc.
If viewed from the point of view of PHP, then two options for use are most likely and common:
- Output the finished image to the user in the browser. This is 99.9% of the cases of working with images in PHP.
- Image processing in terms of graphic information. Crop, format conversion, normalization, rotation, the imposition of effects and ... in general photoshop. This is 0.09%.
- Well, another 0.01% for hellish exoticism
For the first, most common case, the "picture field" is a string variable containing a link to an image that will already be used when generating HTML.
For the second case, the "picture field" should provide access to the graphic information itself. PHP has a number of extensions for this.