CodeIgniter Forums

Full Version: Create thumbnail on canvas?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]ChristiaanT[/eluser]
Hello,

I am wondering if it's possible to create a thumbnail on a blank fixed-sized canvas. I need this to get a perfect image with vertical centering too. So for example I want a thumbnail that has a fixed width and height of 200 x 200px. I wan't to create that blank canvas using GD and then 'place' an image in the center/center of that canvas. Is this possible using the image_lib? I looked around, but can't find a solution here in this forums. Now I hope you can help me.

Thanks for your help.

El Forum

[eluser]ChristiaanT[/eluser]
I already solved this problem with PHP in combination with CSS margin-top. I used PHPs getimagesize() to get the image height, then use a negative top margin from half the height. Also you have to position the image relative with set css top at 50%.

I hope I gave someone an idea with sort-a-like problem...