Resize Image Custom Field

This topic contains 14 replies, has 4 voices, and was last updated by  Paolo 8 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #65595

    algmed
    Buyer
    Post count: 30

    Hi

    I just created a new custom field in place settings.
    The field is a file upload function and I want members to upload an image to the place listing. However, I also want to resize that image to a given size.

    Let’s say I want to display an image of 400x100px size even if they are uploading a 2000x800px image.

    I know the function is somewhere but I can’t find it.
    Any suggestions?

    Thank you!

    #65612

    Guust
    Moderator
    Post count: 29970

    You would have to add some CSS like this:
    .geodir-custom-post-gallery .geodir_thumbnail {width: 400px; height: 100px;}

    To get more precise we’d need to have a URL of a listing where we can see this.

    #65615

    algmed
    Buyer
    Post count: 30

    I was using this code on my dev site (therefor no link) but it didn’t worked very well.
    It was forcing this image to have this one size or the other which makes the image look strange when it is stretched or squeezed.

    I’m not sure if this is how it should work, it was just my best guess.
    Would it be possible to just use the “large” image and use a part of it for the “small” image without resizing or cropping it?

    #65618

    Guust
    Moderator
    Post count: 29970

    It is only the large image that is used. With the CSS you only affect how it is shown on the page, any CSS code does not resize or crop the image itself.
    The image you see on the detail page is just the real image but scaled with CSS.

    #65619

    algmed
    Buyer
    Post count: 30

    Alright, now that makes sense. So I should better make sure images are uploaded in the given size or in a ration where the scaling doesn’t destroy the “view” of the image.
    Thank you so much for your help Guust!

    #65620

    Guust
    Moderator
    Post count: 29970

    You’re welcome 🙂

    #65671

    f.daliessi
    Expired Member
    Post count: 85
    This reply has been marked as private.
    #65683

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    of which image on that page are we talking about?

    Let us know,

    Thanks

    #65754

    Guust
    Moderator
    Post count: 29970

    Like Paolo says, where are your uploaded images on that page?

    #65761

    algmed
    Buyer
    Post count: 30

    Sorry, seems I missed the replies here.
    I’m currently not uploading images. I have used the “upload field” but I have to find out how to use the if function in case there is no image uploaded first.

    If an image is uploaded, it should be shown, if not, the “area” where it usually will be displayed, shouldn’t be shown as “empty”. Currently, if I don’t have an image, it shows a large white space.

    #65765

    Guust
    Moderator
    Post count: 29970

    This is how it would show if you use all the default settings:
    http://geo.goldroo.net/accommodation/australia/queensland/brisbane/hotels/the-sleep-inn/#post_info
    If nothing is uploaded, the tab or field should not even show.

    #65767

    algmed
    Buyer
    Post count: 30
    This reply has been marked as private.
    #65931

    Paolo
    Site Admin
    Post count: 31206

    Have you tried giving width and height : auto with CSS?

    That should do the trick when there is no picture.

    If you provide a link where I can see the placeholder without image, I’ll make sure to give you exactly the code you need.

    Thanks

    #65938

    algmed
    Buyer
    Post count: 30

    Hi Paolo

    I’ve tried auto before but I would like to force the size since I want to avoid smaller images at that place. So auto would kill that option. I’m currently giving the spot/image a predefined size via css.
    Right now I can’t give you a link since it is local, I might move it to my online dev server.

    #65959

    Paolo
    Site Admin
    Post count: 31206

    We’ll be here…

    Thanks

Viewing 15 posts - 1 through 15 (of 15 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket