Jump to content

GD Image size modifications..


Guest

Recommended Posts

Hi All,

In the cart I'm customizing, I noticed that for those of you who are using the GD image library and are using the resize thumbs in other areas, here is a couple more prices of the code..

Using this below will currently resize your images to the small size found here,

http://www.rackspot.com/store/

The code:

{

$thumb=new thumbnail("$site_dir/images/$image");

$thumb->size_width(75);	// set width for thumbnail, or

$thumb->size_height(56);	// set height for thumbnail, or

$thumb->size_auto(45);	// set the biggest width or height for thumbnail

$thumb->jpeg_quality(75);

$thumb->save("$site_dir/images/thumb_$image", $gd_version);

}

If you do replace your code with that above, remember to delete your thumb_ images first or they won't be regenerated.

Chris

Link to comment
Share on other sites

Does anyone know how to get transparent jpg's? I tried this and many variations but it doesn't work. Any ideas?

 if (!file_exists("$site_dir/images/" . "thumb_$image"))

{

$thumb=new thumbnail("$site_dir/images/$image");

$thumb->size_auto(50);	

$thumb->jpeg_quality(100);



//$thumb = ImageCreateFromJpeg("$site_dir/images/$image");

//$white = ImageColorClosest($thumb, 255, 255, 255);

//ImageColorTransparent($thumb, $white);



//$thumb->transparent($white);

$thumb->save("$site_dir/images/thumb_$image", $gd_version);

}

Thanks,

Chris

Link to comment
Share on other sites

If you're talking about transparent like an object on a transparent background - jpegs don't support transparency. You would have to use a gif format.

Teri

Link to comment
Share on other sites

Hello,

Thanks for the reply.. I didn't give it any thought that jpegs can't be transparent.. I don't know much about GD or the functions so I've now been looking for other methods to support gif, jpeg and png images but due to my lack of experience where this stuff is concerned, it's going to take some time before I can sit down and figure that out..

I know how to add gif upload support but I haven't been able to find anything about resizing them.. I'm going to check out netbpm and imagemajick as well and see if I can figure out something..

Thanks again for the reply.

Chris

Link to comment
Share on other sites

;) Chris,

If you don't find a remedy soon and need some help graphic-wise, let me know. There are some tricks and work-arounds that can usually get the job done.

Teri

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...