473,320 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

is there a code to crop bottom border from an image ?

hi
is there a code to crop bottom border from an image when creating thumbnail for this image without crop the original image , but just crop 15px bottom border for creating the thumbnails for the image ?
Dec 13 '09 #1
3 3764
here is creating thumbnail code it's fitting to the image , can we make it crop 15 pixel from the bottom , i mean can we make it fit the all width & the all heigh minus - 15 pixel ?

Expand|Select|Wrap|Line Numbers
  1. #create thumb
  2. $thumb = gd_fit($image,$settings['thumbxy']);
  3.  
Expand|Select|Wrap|Line Numbers
  1.     function gd_fit(&$image, $target) { 
  2.  
  3.         //takes the larger size of the width and height and applies the  
  4.         //formula accordingly...this is so this script will work  
  5.         //dynamically with any size image 
  6.  
  7.         $width = gd_width($image);
  8.         $height = gd_height($image);
  9.  
  10.         if ($width > $height) { 
  11.             $percentage = ($target / $width); 
  12.         } else { 
  13.             $percentage = ($target / $height); 
  14.         } 
  15.  
  16.         //gets the new value and applies the percentage, then rounds the value 
  17.         $width = round($width * $percentage); 
  18.         $height = round($height * $percentage); 
  19.  
  20.         //returns the new sizes in html image tag format...this is so you 
  21.         //can plug this function inside an image tag and just get the 
  22.  
  23.         return gd_resize($image,$width,$height);
  24.  
  25.     } 
Dec 13 '09 #2
You can also use the funcion imagecopyresampled() from the GD lib.

http://php.net/manual/en/function.im...yresampled.php

-------------------------------------
xatcom.net, diseño web
Dec 15 '09 #3
Thanks for reply Dear Carmarri

Greetings
Dec 15 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Kevin Smith | last post by:
Is there a way to "auto-crop" an image in PIL? I have some PNG images with white backgrounds that I want cropped to show only the non-white portion in the center, but I don't see how I can do...
2
by: Michael Winter | last post by:
I have the familiar 'thumbnail' scenario. I want to place a small border around the image when the cursor hovers above it. I use a 1 pixel, solid border around the image that changes between normal...
6
by: John Salerno | last post by:
I might be way off target even looking into this method for what I need to do, but I'm still a little confused about the description of it: crop im.crop(box) => image Returns a rectangular...
1
by: laurakr | last post by:
I am trying to use a clear to get my bottom nav bar below the quote box on the right, but it isn't working. I would like the bottom edge of the quote box to "stick" to the footer nav bar but copy...
3
by: Paul | last post by:
I want the <div id="navigation"column to be the same color all the way to the bottom. The "background-image: url(bg_menu_tile.gif);" was a try to force it with a long 1-pixel graphic - didn't...
1
by: donpro | last post by:
https://testbed.odysseyshipping.com/index.php This is driving me nuts. I've spent much time trying to style this page footer but because I cannot set widths using "display: inline". I've tried...
7
by: praveenb000 | last post by:
Hi, every one on this forum.... I am new to web designing (using HTML/CSS). i designed a web page using HTML, Css with dream weaver. Here is the code i used for the desinging. it appears well...
2
by: sateeshchandrasanga | last post by:
Hi All, My HTML code is working fine in Firefox.But its not displaying any thing in IE.Can you help me in this problem.And in Google crown its displaying but not properly. ...
2
by: everly | last post by:
Hi, I'm helping my friends band and making their MySpace. I messed something up and I can't figure out what it is. Everything is all out of whack on the bottom half of the page. The comments...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.