Answer the question
In order to leave comments, you need to log in
Beautiful photo output script. What is the best way to create a link to an image?
Hello. For the sake of interest, I wrote the output of pictures as in user posts on the wall vk, fb, etc.
Now I want to brush it all up and put it in free use on github. There was a question how it is better to make creation of links to pictures.
At the moment there are two ideas:
class MyPhotoLayout extend PhotoLayout
{
// Функция пользователя для создания ссылки. Вызывается из основного класса.
public function createLink(Item $item)
{
$data = $item->getData(); // Данные пользователя, при добавлении Item
// Создание пользователем ссылки на картинку
// <a href="/photo/id/'.$data->getId().'" onclick=""> или же подобное
}
}
$photo_layout = new MyPhotoLayout();
$item = new Item();
$item->setData(''); // Данные пользователя, для построения ссылки в классе // Например PhotoItem
$photo_layout->addItem($item);
$photo_layout = new PhotoLayout();
$item = new Item();
$item->setLink('link');
$item->setOnclick('js');
$photo_layout->addItem($item);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question