@@ 360-385 (lines=26) @@ | ||
357 | * |
|
358 | * @return string |
|
359 | */ |
|
360 | public function thumbnail($width = 100, $height = 100, $album = false, $alt = '', $default = '') |
|
361 | { |
|
362 | $thumbUrl = $this->thumb(); |
|
363 | $albumUrl = $this->album(); |
|
364 | $alt = ($alt) ? $alt : $this->title(); |
|
365 | ||
366 | if (!$this->hasThumbnail()) { |
|
367 | if (!empty($default)) { |
|
368 | $thumbUrl = $default; |
|
369 | } else { |
|
370 | return false; |
|
371 | } |
|
372 | } |
|
373 | ||
374 | $thumbUrl = Image::resize($thumbUrl, $width, $height); |
|
375 | ||
376 | $html = sprintf('<img src="%1$s" alt="%4$s" width="%2$s" height="%3$s">', |
|
377 | $thumbUrl, $width, $height, $alt |
|
378 | ); |
|
379 | ||
380 | if (true === $album and !empty($albumUrl)) { |
|
381 | $html = sprintf('<a href="%1$s">%2$s</a>', $albumUrl, $html); |
|
382 | } |
|
383 | ||
384 | return $html; |
|
385 | } |
|
386 | ||
387 | /** |
|
388 | * Returns the number of photos. |
@@ 433-458 (lines=26) @@ | ||
430 | * |
|
431 | * @return string |
|
432 | */ |
|
433 | public function thumbnail($width = 100, $height = 100, $album = false, $alt = '', $default = '') |
|
434 | { |
|
435 | $thumbUrl = $this->thumb(); |
|
436 | $albumUrl = $this->album(); |
|
437 | $alt = ($alt) ? $alt : $this->title(); |
|
438 | ||
439 | if (!$this->hasThumbnail()) { |
|
440 | if (!empty($default)) { |
|
441 | $thumbUrl = $default; |
|
442 | } else { |
|
443 | return false; |
|
444 | } |
|
445 | } |
|
446 | ||
447 | $thumbUrl = Image::resize($thumbUrl, $width, $height); |
|
448 | ||
449 | $html = sprintf('<img src="%1$s" alt="%4$s" width="%2$s" height="%3$s">', |
|
450 | $thumbUrl, $width, $height, $alt |
|
451 | ); |
|
452 | ||
453 | if (true === $album and !empty($albumUrl)) { |
|
454 | $html = sprintf('<a href="%1$s">%2$s</a>', $albumUrl, $html); |
|
455 | } |
|
456 | ||
457 | return $html; |
|
458 | } |
|
459 | ||
460 | /** |
|
461 | * Returns the number of photos. |