Advanced Search

Results 1 to 3 of 3

Thread: PHP Photo Album Center Images Within Div

  1. #1
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Photo Album Center Images Within Div

    1) Script Title: PHP Photo Album 2.11

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...photoalbum.htm

    3) Describe problem: I have the script working well here http://www.rjt-online.com/2010%20Web...hotos_live.php.

    However, if the photo is Portrait and the correct width, it fits the containter div nicely (photodiv).

    However if the photo is landscape or larger portrait, the image is cropped.

    I dont want the images to be shrunk by x% as come images are landscape and others are portrait.

    How can I modify my CSS so each image, regardless of the size and regardless of it being portrait/lanscape, fits centrally in the photodiv with equal overflow (hidden) on each side?

    If an images is 500px wide and the photodiv is 200px wide, I want somehow to automatically calculate per image the left and right margins. In this case it would calculate that the left margin needs to be -150px and the righht maring needs to be 150px, therefore the center of the image should be in the center of the photodiv regardless of the size of image.

    Any help would be appreciated.

    Thanks.

  2. #2
    Join Date
    Aug 2004
    Posts
    9,864
    Thanks
    3
    Thanked 960 Times in 949 Posts
    Blog Entries
    15

    Default

    "Photodiv" is wrapped around each thumbnail imag actuallye, and the thumbnail image itself isn't cropped, only resized per ddphpalbum.css (ie: 200px by 160px). Each image is fully viewable, albeit distorted in some cases. Regardless though, if you're asking how to not resize each thumbnail image, but instead center it within the container, it's certainly possible but somewhat complicated to do.
    DD Admin

  3. #3
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Do you know how it can be done?

    I have tried all sorts but I have had no success.

    I am using the same CSS for the images on the right (bottom) of this page http://www.rjt-online.com/2010%20Website/home_new.php , and they are centered correctly as I would like them to be on my photo page.

    Thanks in advance.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •