If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Member #
    when i write the line below, according to the width and height I specify, it shrinks or expands etc.... the image. Is there a way to keep the picture itself intact, but according to the width and height I write, it shows only the portion I want? So the image may just appear partially but not distorted. I know that in css I can say background and do this. But what I want is, I need to use this line in a php code, so I dont think I can do this in css.

    by the way i dont necessarily need to write it like this...all i want is to diaplay part of image without it being distorted..

    <img border=0 width=50 height=20 src="../../pictures/hor5c.jpg">


  3. #2
    Senior Member
    Join Date
    Jun 2005
    Atlanta, GA
    Member #
    1 times
    You actually can do it using PHP, you just have to use inline styling. For example:
    PHP Code:
    <div class="imagePart" style="background-image: url('<?= $picture_path ?>'); background-position: -25px -25px; height: 50px; width: 20px;"></div>
    I would move as much as humanly possible out of the style= portion and into an external stylesheet. For example, if you will always be using one width/height for the viewing area, or a set of them, then make them CSS classes instead and use those to specify the width and height. The background image itself and the background position you will probably have to keep in there, however.

  4. #3
    Senior Member diddy's Avatar
    Join Date
    Jun 2008
    Sydney, Australia
    Member #
    I think what you might be looking for is sprites, using CSS.

    Check out my Google search:

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 02:26 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: