Re: How to create an 128x128 transparent image
- From: pek <kimwlias@xxxxxxxxx>
- Date: Wed, 6 Aug 2008 09:23:47 -0700 (PDT)
On Aug 6, 2:55 pm, Egbert Teeselink <skreb...@xxxxxxxxx> wrote:
On Aug 6, 1:38 pm, pek <kimwl...@xxxxxxxxx> wrote:
On Aug 6, 12:53 pm, Egbert Teeselink <skreb...@xxxxxxxxx> wrote:
On Aug 6, 11:32 am, pek <kimwl...@xxxxxxxxx> wrote:
On Aug 6, 12:06 pm, Egbert Teeselink <skreb...@xxxxxxxxx> wrote:
On Aug 6, 9:10 am, pek <kimwl...@xxxxxxxxx> wrote:
Here is what I want:
I have an image, let's say a JPEG 800x600...
I want to create a transparent 128x128 PNG image and then resize the
800x600 to fit in the center of my transparent 128x128 PNG..
Can you help me/point me to the right direction..?
Thank you very much in advance..
My first reply would be "Don't" - it seems like you'd always end up
with either transparent bars on top and bottom, or on left and right,
no? I assume this is related to some sort of photo thumbnailing, and
in that case I think it would be better to resize the JPEG and use CSS
to add padding to the image (or wrap it in a DIV) so that it is always
outlined as if it is a 128x128 square. The advantage is that you still
have JPG compression, which is much better than PNG for things like
photos. As such, the page will load a lot faster.
Yes, that is exactly what I want to do and I also tried to correct it
with divs but where unsuccessfull. I totally agree that I should NOT
do that. Here is the link to the temporary site:http://treazy.com/pek/products
The three thumbnails in the center are out of my control. I tried
various tricks unsuccessfully and then thought that this bad practice
would at least solve my problem. If you can help correct this in CSS,
I'm totally with you! Otherwise I will follow your suggestions in the
next paragraph.
I'm not sure, but my initial reaction is that your A tag is inline and
wraps the div that contains the image. if you'd make the A block-level
and with a fixed width, centering the image with margin: auto; should
do it. you could then maybe even drop the DIV (the A will be the
containing element).
the other option (that all the css geeks would disapprove of) is using
absolute positioning and computing the left, top indices (relative to
the table cell position, for instance) in PHP by reading the width/
height of the picture and doing some math.
But I do have one more question, I want to make sure that my image
will not exceed (under any circumstance) the size 128x128.. Even if
the width is 100 times bigger than the height, I rather make it a
really small thumbnail.. Any suggestions? I only know how to resize
either the width or the height at 128..
Didn't you ask that question some weeks ago already? I believe people
replied and posted some code too.. Search groups.google.com if you
missed the answer.
The key to the trick is finding out whether the image is higher than
it is wide, or the opposite. In the first case, you compute the
resizing factor by 128/height, otherwise by 128/width. Resample with
that factor, and you're done.
Egbert
Oh yes, I'm really sorry.. Indeed I asked and they answered me
correctly.. I completly forgot.. Thank you and sorry for the trouble..
.
- References:
- How to create an 128x128 transparent image
- From: pek
- Re: How to create an 128x128 transparent image
- From: Egbert Teeselink
- Re: How to create an 128x128 transparent image
- From: pek
- Re: How to create an 128x128 transparent image
- From: Egbert Teeselink
- Re: How to create an 128x128 transparent image
- From: pek
- Re: How to create an 128x128 transparent image
- From: Egbert Teeselink
- How to create an 128x128 transparent image
- Prev by Date: Re: How to save an HTML form's textarea to a file
- Next by Date: imagettftext: Bad character spacing
- Previous by thread: Re: How to create an 128x128 transparent image
- Next by thread: Re: How to create an 128x128 transparent image
- Index(es):
Relevant Pages
|