Help-Me Please QImageControl

thread: 7 messages  |  last: a year ago  |  started: tuesday, march 9, 2010, 8:04 pm pst


#1  |  Leonardo (Minas Gerais) Brazil
Tuesday, March 9, 2010, 8:04 PM PST

hello to everyone.
I have a problem,
need my QImageControl tnha a transparent background.
Ue propriesdade realized the fund is $ strBackColor, however I have
managed to bring the background as transparent, someone knows how to do this?

#2  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Wednesday, March 10, 2010, 9:34 PM PST

Could you possibly rephrase your question?  Not sure if you manually entered the question or used an automated translator, but the question is quite cryptic.

#3  |  Leonardo (Minas Gerais) Brazil
Thursday, March 11, 2010, 9:19 AM PST

In QImageControl when to set a width or height, creates a background that is white by default. I want this background is transparent, is this possible?

Thank you very much.

Note: This is very important to me

#4  |  VexedPanda (Calgary, AB) Canada
Thursday, March 11, 2010, 11:57 AM PST

This isn't possible in the framework currently.
If you're comfortable altering a core file, this can be done though.


In QImageControlBase, in RenderImage, after imagefilledrectangle is called (line 433 in my copy), you can call:
imagecolortransparent($objFinalImage, $clrBackground);

That's it. Now, any image you upload will have a transparent background.

Note that if your image contains the same color as the background, that portion of the image may be transparent as well. To avoid this, set your image control's BackColor property to something that doesn't show up in the image itself.


Having this behavior controlled by a boolean property of QImageControl would be a worthwhile addition to the framework, I think.

#5  |  VexedPanda (Calgary, AB) Canada
Thursday, March 11, 2010, 12:03 PM PST

I've created a ticket for this in QCubed:
http://trac.qcu.be/projects/qcubed/ticket/525

It may also be a nicer approach to dynamically resize the QImageControl itself so that the ratio matches and no background is necessary.

#6  |  Leonardo (Minas Gerais) Brazil
Friday, March 12, 2010, 9:20 AM PST

Thanks for the reply.

I find it very interesting to create a ticket for that.
In the next version this is already implemented?

Arriving home I will try to implement it and resolved by this post.

Thank you again

#7  |  VexedPanda (Calgary, AB) Canada
Friday, March 12, 2010, 9:45 AM PST

No, it's now a known issue / improvement in qcubed with a suggested implementation. The next version of qcubed may or may not adopt this, depending on the feedback and thoughts of others.

Let us know if it works for you though. :)



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.