473,382 Members | 1,651 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,382 software developers and data experts.

Image Display

384 256MB
I upload images of variying sizes for articles but i have a restricted space to show them on, i have 130px wide by 78px high but images can be much bigger is size, how can i display just a section of the image in the 130x78 space without the need to resize and squash the image, for example the below black part is the full image but i only want to display the red box on the article page?

Jun 3 '09 #1
6 1448
Ciary
247 Expert 100+
you will probably need to use an image library: GD is the most common, but if you need something more powerful, i should use imagemagick. you better do no use imagick cause it is way to hard to install.
Jun 3 '09 #2
Markus
6,050 Expert 4TB
An HTML/CSS option:

Expand|Select|Wrap|Line Numbers
  1. <div style="width: 10px; height: 10px; overflow: hidden;">
  2.      <img src="http://img80.imageshack.us/img80/3654/imgz.jpg" />
  3. </div>
  4.  
Jun 3 '09 #3
ziycon
384 256MB
@Markus
What does the overflow attribute do?
Jun 3 '09 #4
Ciary
247 Expert 100+
cuts of everything beyond the border of your element. you'll have to give it a specific width and height though

also, you can position the image to eg -10px to cut of on the left and top side of the image

(actually, this method is better then php. i just forgot the possibilities of html/css for a moment :-s)
Jun 3 '09 #5
ziycon
384 256MB
Cool, i'll give this a shot and let you know. Thanks.
Jun 3 '09 #6
Atli
5,058 Expert 4TB
@Ciary
Actually, it's not. But it is a lot easier and quicker to implement.

The main problem with this method (as I see it) is that you are sending a lot more data than you have to. You are sending parts of images that will never be seen.
PHP could cut of the parts you don't need and just send the rest.

Also, this method relies on the browser to position the image and show the parts you want seen. Browsers tend to disagree on how to interpret your pages, which could lead to your image being displayed incorrectly in certain browsers.
Using PHP, there would be nothing for the browser to misinterpret.

If this is some large-scale project of major importance, I would go with the PHP method.
If it's not a high priority project, the HTML/CSS method is ok.
Jun 4 '09 #7

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

Similar topics

0
by: Doug van Vianen | last post by:
Although I have programmed for several decades I am new to Java. I decided to learn it to create Applets to use in web pages I make as a volunteer in the computer club at a seniors' centre. My...
1
by: Desigan Chinniah | last post by:
I am presently trying to display a list of items INLINE using an image as a seperator..... and having difficulties.... See below for 3 seperate sets of html and css files. Each set does something...
2
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on...
9
by: Rajesh | last post by:
Hi all, Im gonna display a list of images in an aspx page from sql server Db.Each image has a link.When someone clicks the image i want the width and size of the image to be displayed at the...
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
1
by: namratapatil | last post by:
Hi...i am trying to load an image that has been saved at the following path: C:\WTK22\apps\MyProject\res After exectuing the program, the NullPointerException is thrown...Kindly let me know how to...
3
by: =?Utf-8?B?SlIx?= | last post by:
I would like to add text to an image. I have tried to use DrawString and it works on some images but on others it is very very small. I am pretty sure it has something to do with the size of the...
0
by: bindslind | last post by:
The script does most of what it's supposed to do, but I have what seems to be a simple problem that I can't figure out. When the page intitially loads the first page does not display images. The same...
11
by: Chris Beall | last post by:
See http://pages.prodigy.net/chris_beall/Demo/photo%20block%20experiments.html I've ended up with what seems like a rather complex structure for what I thought would be a somewhat simple...
3
by: Froefel | last post by:
Hi group, I'm looking for some help on how to achieve the following in a gridview control that is based on an ObjectDataSource. The SelectMethod of the datasource returns a list of Customer...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.