Показывать значок PDF вместо изображения в галерееPhp

Кемеровские программисты php общаются здесь
Anonymous
Показывать значок PDF вместо изображения в галерее

Сообщение Anonymous »

Я создаю простую PHP-галерею, которая динамически сканирует папки и отображает изображения. В настоящее время сценарий хорошо работает со стандартными форматами изображений, такими как JPG, PNG и GIF. However, I want to extend this functionality to include PDF files.
The Goal: When the script encounters a PDF file in the directory, I don't want it to just show a broken image link or a text URL. Instead, I want it to display a specific "PDF icon" image that acts as a thumbnail, which users can click to open the document.
The Logic:
  • Update the glob or extension filtering to recognize .pdf files.
  • In the foreach loop, check the file extension.
  • If it's an image, render the file itself.
  • If it's a PDF, render a local pdf-icon.png.

Код: Выделить всё






[*]
Document





[list]

[/list]





это мой первый пост, так что извините, если я неточен

Вернуться в «Php»