Welcome Guest, Not a member yet? Register   Sign In
On image crop change Black Background overage to white?
#1

[eluser]theRiley[/eluser]
I've looked through this forum, and many other places... still no luck.

I usually crop/resize images so it detects size and crops the middle portion so no Black Background overages are seen. However my client would like the FULL jpg to be visible without any cropping, but the end result JPG still has to be a set size.

If it's a tall source picture then there's white borders on the left and right, if it's a long picture then white borders on the top and bottom. In both cases the final JPG will be a specific size with the image centered and white borders in the areas left over.

I can get everything to work by modifying my usual code... but I can't change the color from Black to White on the overages.

I've been monkeying around with the image_lib source code, but not sure what's i'm doing. Even used PHP to draw a rectangle and then crop the image.. but the image with black borders just goes over the rectangle

Can anyone please point me in the right direction? Thanks! I can post whatever code would help, but hopefully it's just something I can add to Image_lib.

Thanks!
#2

[eluser]Mat-Moo[/eluser]
You can set the BG colour with my Image_moo lib, but you will need php5 and gd2 (see sig).
#3

[eluser]theRiley[/eluser]
Wow, great library.. exactly what I needed.

Wish i found it when I started CI a couple of months ago.. spent way too many unbillable hours on my first 3 sites getting crop/resize math to work.

Love it
#4

[eluser]Mat-Moo[/eluser]
Your welcome Smile




Theme © iAndrew 2016 - Forum software by © MyBB