I need a solution to center images vertically when using Fixed width and height
When doing this new the image is is at the top with the white space below filled with the fill color defined
When doing this new the image is is at the top with the white space below filled with the fill color defined
You could probably update the file: webassist/file_manipulation/helperphp.php
On line 1021 you should find:
imagecopyresampled($tmp,$src,0,0,0,0,$newWidth,$newHeight,$width,$height);
update that to:
imagecopyresampled($tmp,$src,round(($width-$newWidth)/2),round(($height-$newHeight)/2),0,0,$newWidth,$newHeight,$width,$height);
Thanks Ray, that gave me the clue I needed to modify the code.
What was the correct modification?
Ray,
imagecopyresampled($tmp,$src,0,round(($height-$newHeight)),0,0,$newWidth,$newHeight,$width,$height);
This is what I ended up using for my needs
It seems like that would move it to the bottom, not center it. That centers the image? I'm going to have to play with it so I can get my head around why that works.
It worked for me because of how thin the image I am working with is, see link in PM
Thanks for the link. I still don't quite understand why it works, but I'll set it up in a test environment and see if I can get my head around it later today.
No worries, your original code pushed the image off to the left for me.
Thanks for the update... I'm going to play around with it today.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.