Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Titoratus/2af9af74eff3322c8c2eafdb7a31fd1c to your computer and use it in GitHub Desktop.
Save Titoratus/2af9af74eff3322c8c2eafdb7a31fd1c to your computer and use it in GitHub Desktop.
Вывод картинок record'а на обычной странице
Модель::all()->last()->vlk_file->getPath();
Другой вариант:
// Это в обычной функции
$images = array();
// $records равен запросу в бд с выборкой чего-либо
foreach($records as $index => $record)
$images[$index] = \System\Models\File::where('attachment_id', $record->id)->get();
$this['images'] = $images;
// Теперь выводим через Twig
{% set ind = loop.index - 1 %}
{% for image in images[ind] %}
<a href="{{ image.getPath() }}"><img src="{{ image.thumb(200, auto) }}" alt=""></a>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment