ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Remove the {filedir_1} from the start of the rendered sql call

July 27, 2011 6:11am

Subscribe [3]
  • #1 / Jul 27, 2011 6:11am

    colesi

    3 posts

    Hi there wonder if anyone can help with this…

    Does anyone have any idea of how to remove the

    https://ellislab.com/asset/images/team-photo/

    from the start of the rendered call for an image from a sql query?
    I have tried using the ‘Parse Filedirectories’ plugin which does turn the

    https://ellislab.com/asset/images/team-photo/

    into the file path.

    However I would like the output to be put into an image resizer to create thumbnails for the gallery.
    I’m using ‘EE2 ED Image Resizer’ but this does not seem to work with ‘Parse Filedirectories’, possibly because you have the Parse Filedirectories tag within the imgresizer tag.

    Any thoughts?

    Thanks
    Ian

  • #2 / Jul 27, 2011 12:38pm

    colesi

    3 posts

    Here’s the code i’m using if this helps to give a better explanation :

    {exp:query sql="SELECT DISTINCT
                        t.col_id_4 AS imageFile 
                    FROM 
                        exp_matrix_data AS t NATURAL JOIN
                        exp_category_posts AS p
                    WHERE 
                        t.field_id = 11 AND
                        (p.cat_id = '1' OR p.cat_id='2') AND 
                         col_id_4 != ''
                    ORDER BY row_id DESC
                    LIMIT 6 "}  
    
                    {imageFile} <-- renders https://ellislab.com/asset/images/team-photo/IMG_0863.JPG 
    
                    {exp:parse_filedirectories}{imageFile}{/exp:parse_filedirectories} <-- renders <a href="http://www.elinmanahanthomas.org/uploads/IMG_0863.JPG">http://www.elinmanahanthomas.org/uploads/IMG_0863.JPG</a>
    
                    {exp:ed_imageresizer image="{imageFile}" maxWidth="151" cropratio="151:151" class="GalleryImg" } <-- renders nothing
    
                    {exp:ed_imageresizer image="{exp:parse_filedirectories}{imageFile}{/exp:parse_filedirectories}" maxWidth="151" cropratio="151:151" alt="{image_caption}" class="GalleryImg" }  <-- also renders nothing
    
             {/exp:query}
  • #3 / Jul 27, 2011 7:13pm

    the3mus1can

    426 posts

    EDIT:

    After looking at ed_imagesizer’s source this might be an easier approach (untested SQL):

    {exp:query sql="SELECT DISTINCT
                        REPLACE(t.col_id_4, 'https://ellislab.com/asset/images/team-photo/', '') AS imageFile 
                    FROM 
                        exp_matrix_data AS t NATURAL JOIN
                        exp_category_posts AS p
                    WHERE 
                        t.field_id = 11 AND
                        (p.cat_id = '1' OR p.cat_id='2') AND 
                         col_id_4 != ''
                    ORDER BY row_id DESC
                    LIMIT 6 "}

    You are probably going to have to tweak it a little to get it to work right, but at least it is a start. Cheers.


    I would turn on template debugging and see if ed_imagesizer is logging any errors/warnings.  You also might check and make sure the ed_imagesizer cache directory has the proper file permission.

  • #4 / Jul 28, 2011 6:28am

    colesi

    3 posts

    Thanks so much worked like a charm!
    All I had to do was add the full filedir in the html before the imageFile.

    I never knew about the template debugging and that’s a great help too!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases