CodeIgniter Forums
Create thumbnail on canvas? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Create thumbnail on canvas? (/showthread.php?tid=24302)



Create thumbnail on canvas? - El Forum - 11-05-2009

[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.


Create thumbnail on canvas? - El Forum - 11-06-2009

[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...