TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Gd images (http://www.talkphp.com/general/2469-gd-images.html)

Orc 03-13-2008 05:42 AM

Gd images
 
How would I get images to stay in the imagecreatetruecolor, so I don't have to see the black?

xenon 03-13-2008 10:00 AM

Please provide a less obscure description of your problem...

Orc 03-13-2008 11:07 AM

Quote:

Originally Posted by xenon (Post 12350)
Please provide a less obscure description of your problem...

How would I have the width and height set to where it fits the image color, using imagecreatetruecolor, the background is black, and no matter how much I try when using imagecopyresampled, it will show the background imagecreatetruecolor

Rendair 03-13-2008 11:49 AM

imagecreatetruecolor() returns an image identifier representing a black image of the specified size.

in order to change the background colour you can use the following script.

PHP Code:

$bg imagecolorallocate($im2331491); 

Place right after the imagecreatetruecolor()

Orc 03-13-2008 03:06 PM

Quote:

Originally Posted by Rendair (Post 12352)
imagecreatetruecolor() returns an image identifier representing a black image of the specified size.

in order to change the background colour you can use the following script.

PHP Code:

$bg imagecolorallocate($im2331491); 

Place right after the imagecreatetruecolor()

I know that, but you don't get what Im saying.. I mean Im getting the image from a database. And I hate black backgrounds showing up, ya know, so yeah.

Nor 03-13-2008 03:11 PM

I'm guessing your trying to do transparency images?

Orc 03-13-2008 04:41 PM

Quote:

Originally Posted by Nor (Post 12357)
I'm guessing your trying to do transparency images?

imagesavealpha, yes yes, I know but.. Hmm? Would that work?

Rendair 03-13-2008 05:10 PM

Quote:

Originally Posted by Orc (Post 12356)
I know that, but you don't get what Im saying.. I mean Im getting the image from a database. And I hate black backgrounds showing up, ya know, so yeah.

You dont need to be rude about it i am sorry if you are not very clear on what exactly you want

Salathe 03-13-2008 05:14 PM

How about giving everyone a visual example (starting images [yes, from the database], resulting images [with black backgrounds] and the appropriate code you're using [or all of it])?

Orc 03-13-2008 05:49 PM

Sorry Rendair, hang on, lemme try to make it better..


Say that the black was the imagecreatetruecolor width and height, when cropping images, it does this to me, when just resizing it, its fix, how would I get this? Say, to a certain point of which the image width ends, I dont want imagecreatetruecolor width's black, I would it to be stopped, how would I do this?

Or shall I delete this thread, and figure it out myself? I don't know what else to say. :/

xenon 03-13-2008 11:21 PM

Well, I'd suggest you calculate the thumbnail dimensions BEFORE creating the virtual image to store the thumb into. Then, you wouldn't have problems with imagecopyresampled. If the image has some transparent pixels around it, run a function on the image to see where is the image ending (imagecolorat).

Orc 03-13-2008 11:23 PM

Quote:

Originally Posted by xenon (Post 12381)
Well, I'd suggest you calculate the thumbnail dimensions BEFORE creating the virtual image to store the thumb into. Then, you wouldn't have problems with imagecopyresampled. If the image has some transparent pixels around it, run a function on the image to see where is the image ending (imagecolorat).

I have done that. I took the width and height and list() them and then put them in the database like so 000x000, then I went and explode() the x and made $foo[0] and $foo[1] thus gave me the width and height.

Nor 03-14-2008 03:48 AM

Mind posting your code :D & db table example


All times are GMT. The time now is 08:00 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0