Custom Content Type Manager
responsive images :raw (3 posts)

  1. trkoehler
    Posted 4 years ago #

    i´m having some troubles regarding the to_image_array_OutputFilter using the third example with raw image...

    it scales to 100% but crops the image in the height... i want it to be responsive...

    <?php $image_id = get_custom_field('Bild1');
    list($src, $w, $h) = wp_get_attachment_image_src($image_id);?>
    <img src="<?php print $src; ?>" width="100%" height="auto" />

    it somehow seems that it takes the wrong picture id too...

    i´m using Version


  2. trkoehler
    Posted 4 years ago #

    get_custom_field('Bild1' 'full'); didn´t work... so i put full instead of thumbnail in wp-includes/media.php - if there´s another way please let me know...

  3. fireproofsocks
    Plugin Contributor

    Posted 4 years ago #

    I'm not sure if handled that correctly -- the current version is, so I'd recommend that you update specifically because 0.9.4 brought a lot of improvements to the Output Filter functionality. There's a page in the wiki: http://code.google.com/p/wordpress-custom-content-type-manager/wiki/OutputFilters including a video. The sample templates in 0.9.4.x are also improved, giving you fuller examples of how to use the output filters.

    If you're using the "to_image_array" filter, then it should be returning an array of image attributes, so if that's what your field is using, then the get_custom_field() function would return an array, not the image id... like this:

    <?php list($src, $w, $h) = get_custom_field('Bild1');?>

    In 0.9.4, you can double-check this or override it by specifying the "raw" filter, and that would give you your image id:

    <?php $image_id = get_custom_field('Bild1:raw');?>

    But that's only available in 0.9.4. You can check the image id with your uploaded media items... find the image you linked to, and if you edit it, your URL should display the image id, e.g. "123" in the example below:


    Also... Your images should be scaled in terms of pixels, not in percentages. A lot of layouts clip the content area so if your image is too large, it gets clipped. This could be what you're experiencing.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic