Need custom modifier to strip out image tag

A place to make for-pay "CMS made simple" job offerings
Post Reply
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Need custom modifier to strip out image tag

Post by giggler »

I have a field that users upload an image through the editor, so it displays like this in the database:

Code: Select all

<img src="path/images/image-filename.jpg" align="middle" height="289" width="369" />


I need to strip everything and only display "image-filename.jpg". I posted in the smarty forum and I got a reply that says to "write a custom modifier to strip it out." I would like to keep an easy tag using smarty of course.

I can see that TinyMCE advance popup is able to display "path/images/image-filename.jpg" using some function.

If anyone can do this, please pm me the cost.

Thanks!
Last edited by giggler on Sun Nov 25, 2007 10:58 pm, edited 1 time in total.
aozuas

Re: Need custom modifier to strip out image tag

Post by aozuas »

Isn't simple to put that in your template?


Then, upload the image using the Image Manager. After that you Add New Content, using the template with the field described above and just fill the image name in the field.
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: Need custom modifier to strip out image tag

Post by giggler »

I'm trying to use the Notes area of cataloger so that users can upload with the image manager and wanted to do some onmouseover stuff with it (but since the editor embeds the image tag, it's hard to do the onmouseover).

I've tried using the content block tag, but doesn't seem to appear in the cataloger module. While this is easy for us to do, a client may find that too complicated.

BTW-I guess this is what TinyMCE uses to get the image url without the tag:

Code: Select all

convertAllRelativeURLs : function(body) {
      var i, elms, src, href, mhref, msrc;

      // Convert all image URL:s to absolute URL
      elms = body.getElementsByTagName("img");
      for (i=0; i<elms.length; i++) {
         src = tinyMCE.getAttrib(elms[i], 'src');

         msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
         if (msrc !== '')
            src = msrc;

         if (src !== '') {
            src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, src);
            elms[i].setAttribute("src", src);
         }
      }
Last edited by giggler on Mon Nov 26, 2007 12:26 am, edited 1 time in total.
alby

Re: Need custom modifier to strip out image tag

Post by alby »

giggler wrote:I've tried using the content block tag, but doesn't seem to appear in the cataloger module. While this is easy for us to do, a client may find that too complicated.


I posted a patch for cataloger for include file

Alby
giggler
Forum Members
Forum Members
Posts: 197
Joined: Tue Oct 09, 2007 7:08 am

Re: Need custom modifier to strip out image tag

Post by giggler »

I think this solution will still produce the tag. I want to be able to use onmouseover using the smarty tag and need to strip the tag and attributes and leave just the filename.jpg.

Is this not possible?
alby

Re: Need custom modifier to strip out image tag

Post by alby »

giggler wrote:I think this solution will still produce the tag. I want to be able to use onmouseover using the smarty tag and need to strip the tag and attributes and leave just the filename.jpg.

Is this not possible?


No, I have filename of file. My template is:

Prodotto: {$nome}



{$jpg_logo_item}" alt="{$jpg_logo_item}" />



{$notes}




{if $pdf_opuscolo != ""}
  {$pdf_opuscolo}" target="_blank">pdf opuscolo Opuscolo prodotto

{/if}
......................


Alby
Post Reply

Return to “Help Wanted (commercial)”