lxndr Posted March 26, 2007 Share Posted March 26, 2007 I have a routine which reads in the names of all the GIF graphic files from a particular directory and displays the actual images but what I want to be able to do is just display a PART of each image. For example, all of the images are 500 pixels wide by 55 pixels high and I want only to display the first hundred pixels width of the image so that I would in effect have just a portion of each image starting from the left and 100 pixels wide. Can it be done ? Quote Link to comment https://forums.phpfreaks.com/topic/44420-solved-displaying-only-a-portion-of-a-graphic-image/ Share on other sites More sharing options...
Barand Posted March 26, 2007 Share Posted March 26, 2007 Yes. http://www.php.net/imagecopy Quote Link to comment https://forums.phpfreaks.com/topic/44420-solved-displaying-only-a-portion-of-a-graphic-image/#findComment-215701 Share on other sites More sharing options...
AndyB Posted March 26, 2007 Share Posted March 26, 2007 Another way of doing that would be to use the graphic images as the background to a defined area that's 100px wide by 55px high. You could do that with a series of size-defined divs, but it might be easier to use a table with each cell having a different background defined and a transparent 100px by 55px image as cell content. Quote Link to comment https://forums.phpfreaks.com/topic/44420-solved-displaying-only-a-portion-of-a-graphic-image/#findComment-215702 Share on other sites More sharing options...
lxndr Posted March 26, 2007 Author Share Posted March 26, 2007 Thanks to both of you for the speedy replies, I shall follow up your suggestions. .. Quote Link to comment https://forums.phpfreaks.com/topic/44420-solved-displaying-only-a-portion-of-a-graphic-image/#findComment-215704 Share on other sites More sharing options...
Barand Posted March 26, 2007 Share Posted March 26, 2007 As usual it's a tradeoff. To resize the image uses server resources To truncate the image on output uses extra bandwidth as the whole image is still sent. Quote Link to comment https://forums.phpfreaks.com/topic/44420-solved-displaying-only-a-portion-of-a-graphic-image/#findComment-215711 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.