Results 1 to 6 of 6

Thread: Generating thumbnail images

  1. #1
    User
    Join Date
    07-01-09.
    Posts
    91

    Default Generating thumbnail images

    I have a need to generate a custom sized thumbnail image that isn't defined in the catalog edit page.

    In other words, I have a product catalog where I provide a place to choose/upload an image file that serves as the "Main Image" for the product. This image is used in a varety of places (product list, the main product page, etc). The main reader page the size is defined in the field definition and the list pages are using the override setting in the module. However, I am setting up a secondary reader page with an alternate layout where the default size I set will not work.

    Can I call the "Raw" image in the template and give it the new dimensions and make the appropriate thumbnail?

    So, for example, the current code I have for displaying the image is:
    Code:
    <?php echo $entry['data']['product_image']['value'];?>
    What would I do to override in the template the current image size and give it something specific for the new reader page? I'm not interested in having it customized per item, this would be the same for all items.

  2. #2
    User
    Join Date
    06-20-09.
    Location
    Middlesbrough, UK
    Posts
    246

    Default Re: Generating thumbnail images

    I use this code in my template to bring in images:

    You can hardcode the width and height and bring in the image stored in the tl_files folder rather than the resized image the module settings create. This may take longer to load but should work.

    If you use the print_r ($this); in your template you can see the options. Think it would be something like:
    Code:
    [img]<?php echo $entry['data']['image'][raw]; ?>[/img]" title="<?php echo $entry['data']['name']['value']; ?>" >[img]<?php echo $entry['data']['image'][raw]; ?>[/img]" width="200" height="200" /></a>
    ['image'] being the field name of your image field set in the catalog
    360fusion: Virtual Tours - Web Design
    Social Media: Twitter - Facebook Page

  3. #3
    User
    Join Date
    08-15-09.
    Location
    Sweden
    Posts
    82

    Default Re: Generating thumbnail images

    Why not use the insert tag that automaticly resizes images on the fly?

    For example:
    Code:
    {{image::<?php echo $entry['data']['image']['meta'][0]['src']; ?>?width=136&height=136}}
    Documentation for Insert tags

  4. #4
    User
    Join Date
    07-01-09.
    Posts
    91

    Default Re: Generating thumbnail images

    I Love you. Thank you, the Insert Tags worked perfectly.

  5. #5
    User
    Join Date
    06-20-09.
    Location
    Middlesbrough, UK
    Posts
    246

    Default Re: Generating thumbnail images

    Well I think I will be using that in the future too.
    360fusion: Virtual Tours - Web Design
    Social Media: Twitter - Facebook Page

  6. #6
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Generating thumbnail images

    Now you can thank me for getting the image inserttag I created, implemented into the core... That's such a neat inserttag, right...

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
  •