Page 1 of 1

Need custom modifier to strip out image tag

Posted: Sun Nov 25, 2007 10:56 pm
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!

Re: Need custom modifier to strip out image tag

Posted: Sun Nov 25, 2007 11:09 pm
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.

Re: Need custom modifier to strip out image tag

Posted: Mon Nov 26, 2007 12:24 am
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);
			}
		}

Re: Need custom modifier to strip out image tag

Posted: Mon Nov 26, 2007 11:02 am
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

Re: Need custom modifier to strip out image tag

Posted: Tue Nov 27, 2007 7:30 am
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?

Re: Need custom modifier to strip out image tag

Posted: Tue Nov 27, 2007 8:36 am
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}





{$notes}




{if $pdf_opuscolo != ""}
  Opuscolo prodotto

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