We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17058
    • 80 Posts
    Hi everybody,

    i’ve wrote a nifty jQuery function to show copyright-information of images. some of the documents starts with a larger photo. my costumer is able to set these images via the image TV on documents. The js-function looks for a special textcombination ( eg. ’copy’) in the alt-attribute to wrap some things around the image and show the copyright infos.
    The artists and urls are different. (<- no default alt-attribute useful)

    So, the question is: How to configure/tweak the Image-TV to give the reda in the backend the possibility (by an additional inputfield) to set the alt manually with some information? The default attribute set in the TV-config should be overidden.

    There are a large amount of images. thats why it’s not such a good idea to read the imagenames with a modified js-function.

    thanks for help, le block
      le_block is Member of FUTY | Medienagentur aus Leipzig mit Schwerpunkt Marketing, Branding, Print und Webdesign
      • 27330
      • 884 Posts
      how about setting for the image TV an ID or a class by default and use it for your niffty jQuery script nstead of the alt tag?
      just an idea.
        • 17058
        • 80 Posts
        Hi sinbad,thanks.

        I’m not quite sure i understand your answer. your idea is to give each image a unique id and a list of the copyright infos to show? but thats quite similar to the method of renamig the images plus a separate textfile. if you mean the css-id the problem is still existing because there is only one id (given for all startimages) set in the tv-config.

        i wanna extend (with the help of this forum) the image tv (hardcoded or the elegant way) to get a second input field. Plus: i’ll better understand the TVs.

         
          le_block is Member of FUTY | Medienagentur aus Leipzig mit Schwerpunkt Marketing, Branding, Print und Webdesign
          • 7231
          • 4,205 Posts
          You want to automatically associate an image with copyright information? You can do this by using something like MaxiGallery to manage the images. MG has data fields for the title and alt information and you could build a simple widget using MG to get the image and put it on the screen.

          Here is a discussion on this with an example. I have used this in a project and it worked well. To select the image I added a combo pull down to list the images available.

          Also the MaxiGallery in manager widget for MangerManger will allow you to manage the images in the manager. I have not tried this out yet but it should work nicely.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 17058
            • 80 Posts
            Hi Guys, thanks for not responding to my question.  wink (just a joke).

            @dev_cw. thanks for you workaround.
            You want to automatically associate an image with copyright information?
            Yes/no/maybe. Some of the pics - not all.

            Let me say, my costumer isn’t the person who easily accept special-purpose solution or change his will. (short: he isn’t an easy person)
            So i don’t want to impose him on new things.

            Thats why I look for the second-inputform (text) solution . As i mentioned earlier,the benefit for me is, i will understand the TV better.
            I think I’ve to dig in the PHP-Code. But I’m a PHP-Noob. I don’t know where and what to change. And i guess a have to generate a new table of the DB.

            Thanks again, I’ll give your solution in an upcoming project definitively a try.

            le block
              le_block is Member of FUTY | Medienagentur aus Leipzig mit Schwerpunkt Marketing, Branding, Print und Webdesign
              • 31136
              • 72 Posts
              I’ve this problem to.
              And first thing I got - to use addition edit TVs for every image TVs. I’m using this way yet.

              Yesterday I tried new idea: alt of image could be added to URL separated by "#" (assets/images/car.jpg#My car).
              All browsers will open your image with #-addition correctly!
              You can use little plugin to generate alt-tags on page and clean images URL automatically!
              I’m testing this method now, and if it could be useful for You - I can share plugin.
                • 17058
                • 80 Posts
                @urique.

                And first thing I got - to use addition edit TVs for every image TVs. I’m using this way yet.
                Can you explain this technique a little more detailed? How to edit? The code of the TV itself? this could be a good starting point.

                thanks for your help, le block
                  le_block is Member of FUTY | Medienagentur aus Leipzig mit Schwerpunkt Marketing, Branding, Print und Webdesign
                  • 31136
                  • 72 Posts
                  Quote from: le_block at Nov 07, 2008, 06:55 AM

                  Can you explain this technique a little more detailed? How to edit? The code of the TV itself? this could be a good starting point.

                  The idea is to add alt-text to URL of image-TV value.
                  For example, if Your image URL is assets/images/photo.jpg, and You want to add alt-text "This is my family", You need just modify URL of image-TV by hands like this: assets/images/photo.jpg#This is my family (this URL will correctly opened by any browser!).

                  The second step is to enable little plugin.
                  How It works: plugin searches image URLs with "#" additions, adds alt-attribute and cleans "#" addition from img-src!

                  Just try this (and if this idea will be useful, I will add plugin to official repository)
                  /*
                  	Name:	Alta
                  	Version: 	1.0.0
                  	Author:	Urique ([email protected])
                  	Date:	2008-11-04
                  */
                  
                  $e = &$modx->Event;
                  switch ($e->name)
                  {
                  	case 'OnWebPagePrerender':
                  		$out = &$modx->documentOutput;
                  		$search = '/(<\s*img[^>]+)(src\s*=\s*["|\'])([^"|^\']*)#([^"|^\']*)(["|\'])/i';
                  		$replace = '\\1\\2\\3\\5 alt=\\5\\4\\5 title=\\5\\4\\5';
                  		$out = preg_replace($search,$replace,$out);
                  	break;
                  
                  	default:
                  		return;
                  	break;
                  }
                  


                  How to install:
                  1. Create plugin with name "Alta" and paste the code
                  2. Check "OnWebPagePrerender" event and save it
                  3. Make sure that plugin is run first on "OnWebPagePrerender" event
                  4. Add #-addition to any URL of image-tv and refresh FrontEnd page!

                  Waiting 4 comments…