PHP Code to Create and Use Thumbnails
In our system Typolight is used to manage most parts of the webpage. However, there are some scripts which are out of the scope of Typolight (e.g., Perl scripts managing incoming emails etc.) Some of these Perl scripts put image files in the tl_files folder of Typolight. I would like to know the PHP code to create thumbnails of these images.
I would like to program some custom PHP code which reads from an SQL database and creates portions of the webpage rendered by Typolight. My custom code should create thumbnail images, display thumbnail images, and link to the original (big) images.
But how do I create thumbnails and how do I retrieve them? I searched a bit through the sources of Typolight but couldn't find the parts where Typolight does exaclty this.
Thanks :)
Re: PHP Code to Create and Use Thumbnails
The code to resize images is in system/libraries/Controller.php - function name is getImage
However if you want to display your content through TL, you may simply use image insert tag and TL will automatically create thumbnails for you.
Re: PHP Code to Create and Use Thumbnails
Thanks for your reply, I will check the code.
Quote:
Originally Posted by scare
However if you want to display your content through TL, you may simply use image insert tag and TL will automatically create thumbnails for you.
Sorry, I might find this in the user manual also. Just wanted to ask, how the image insert tag works. My content needs some more PHP though, will have to query a MySQL database as well.
Best regards
Re: PHP Code to Create and Use Thumbnails
I don't know what precisely do you aim for, but it looks like building custom module is the way to go :) Here is a tutorial http://dev.typolight.org/wiki/TutorialsExtension - you may need to create frontend module only, if you already have data in db table.
As for image insert tag, you basically create output of your module as follows:
Then TL takes the output and creates required thumbnail and generates correct image tag.
http://dev.typolight.org/wiki/EnglishIn ... ram2value2
Re: PHP Code to Create and Use Thumbnails
Cool, thanks a lot for your help. Nice forum here :)