- $res = XDB::query("SELECT * FROM photo WHERE attachmime IN ('jpeg','png') AND uid={?}", $x['user_id']);
- if ($i = $res->numRows()) {
- $old2 = $this;
- $photo = $res->fetchOneAssoc();
- $width = $photo['x'] * 20/$photo['y'];
- $GLOBALS["p{$x['user_id']}"] = $photo['attach'];
-
- $_x = $this->getX();
- $_y = $this->getY();
- $this->Cell(0, 20, '', '', 0, '', 1);
- $this->Image("var://p{$x['user_id']}", $_x, $_y, $width, 20, $photo['attachmime']);
-
- if ($this->error) {
- $this = $old2;
- } else {
- $this->setX($_x);
- $this->Cell($width, 20, '', "T");
- $h = 20 / $this->wordwrap($nom, 90-$width);
- $this->MultiCell(0, $h, $nom, 'T', 'C');
- $ok = true;
+ $photo = $profile->getPhoto(false, true);
+ if ($photo) {
+ list(, $type) = explode('/', $photo->mimeType());
+ $type = ($type == 'jpeg') ? 'jpg' : $type;
+ if (method_exists($self, '_parse' . $type)) {
+ $old2 = clone $self;
+ $width = $photo->width() * 20 / $photo->height();
+ $_x = $self->getX();
+ $_y = $self->getY();
+ $self->Cell(0, 20, '', '', 0, '', 1);
+ error_reporting(0);
+ $self->Image($photo->path(), $_x, $_y, $width, 20, $type);
+ error_reporting($self->report);
+
+ if ($self->error) {
+ $self = clone $old2;
+ } else {
+ $self->setX($_x);
+ $self->Cell($width, 20, '', "T");
+ $h = 20 / $self->wordwrap($nom, 90 - $width);
+ $self->MultiCell(0, $h, $nom, 'T', 'C');
+ $ok = true;
+ }