Start of using Attribute objects, rendering jpegphoto
This commit is contained in:
@@ -7,18 +7,19 @@ use App\Classes\LDAP\Attribute\Binary;
|
||||
/**
|
||||
* Represents an attribute whose values are jpeg pictures
|
||||
*/
|
||||
class JpegPhoto extends Binary
|
||||
final class JpegPhoto extends Binary
|
||||
{
|
||||
public function __toString(): string
|
||||
{
|
||||
$result = '';
|
||||
// We'll use finfo to try and figure out what type of image is stored
|
||||
$f = new \finfo;
|
||||
|
||||
foreach ($this->values as $value) {
|
||||
switch ($x=$f->buffer($value,FILEINFO_MIME_TYPE)) {
|
||||
case 'image/jpeg':
|
||||
default:
|
||||
$result .= sprintf("<img style='display:block; width:100px;height:100px;' src='data:%s;base64, %s' />",$x,base64_encode($value));
|
||||
$result .= sprintf('<img class="jpegphoto" src="data:%s;base64, %s" />',$x,base64_encode($value));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user