User Tools

Site Tools


import_replacements

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
import_replacements [2014/01/29 18:04] – external edit 127.0.0.1import_replacements [2026/03/21 10:11] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ===== Import Replacements ===== ===== Import Replacements =====
  
-Rotation Settings Import Replacements you can add autoreplacements that will be used always when you import something, that means both Import and ImportSets and even TubeImport+In Rotation Settings Import Replacementsyou can create auto-replacement rules for imported data. This is useful for automatically modifying embed sizes, URL components, or other fields during import.
  
-This is very useful to remove\replace some text in import, for example size of embedded video or some text in gallery description.+**Example 1: Adjusting embed size**
  
-**Example 1**+Suppose xVideo embeds have width=400, but you need width=500:
  
 <code> <code>
-xvideo has embedded cideos with width=400  while we need width=500 
  
-If this field  = URL +If this field = URL 
-Contains this value = xvideo +Contains this value = xvideo
  
-ie this rules works only if we have 'xvideo' in URL +Then Search For - width=400 
 +in This Field - embed code 
 +And Replace it With - width=500
  
-Then Search For  width=400 (what we have in original format) +</code> 
-in This Field  embed code (width=400 is located in embedded code) + 
-And Replace it With -  width=500+**Example 2: Changing URL parameters** 
 + 
 +An RSS feed provides URLs like http://somesponsor/gallery/xxxx.html?id=25, but you need id=30: 
 + 
 +<code> 
 + 
 +If this field = URL 
 +Contains this value = somesponsor 
 +Then Search For - id=25 
 +in This Field - URL 
 +And Replace it With - id=30
  
 </code> </code>
  
-**Example 2** 
  
-Let's say we have import like  http://somesposnor/gallery/xxxx.html?id=25while we need  id=30.+==== EMPTY_VALUE ==== 
 + 
 +Replacements support special meta tags for conditional field operations. For SEO purposesyou often need multiple descriptions for a single gallery. Instead of manually entering duplicate content, you can use meta tags to automatically copy and populate fields. 
 + 
 +Available meta tags: 
 + 
 +  <!--EMPTY_VALUE--> - the field is empty 
 +  {DESCRIPTION}, {ALT}, {URL}, etc- gallery field variables 
 + 
 +**Example: Populate empty Title from Description**
  
 <code> <code>
-If this field  URL + 
-Contains this value = somesposnor +If this field = Title 
-Then Search For  id=25 +Contains this value = <!--EMPTY_VALUE--> 
-in This Field  URL +Then Search For - * (entire field) 
-And Replace it With -  id=30+in This Field - Title 
 +And Replace it With - {DESCRIPTION}
  
 </code> </code>
 +
 +This rule copies the gallery description into any empty Title field, automatically generating a second description for SEO purposes. You can adapt this to copy to other fields like URL or custom fields as needed.
 +
 +
 +  <!--SPECIAL_CHARS_ONLY-->
 +
 +special variable to indicate that the field contains only "-,.'#? and space (so it doesn't look like a normal description)
 +
 +
 +==== ANY_VALUE ====
 +
 +Like EMPTY_VALUE, but indicates the field contains something (the opposite condition).
 +
 +==== external:: ====
 +
 +This feature was originally designed for translations but works for any external processing of field values. You can call an external URL to modify imported data.
 +
 +**Example: Randomly add punctuation to descriptions**
 +
 +Create a PHP script at http://domain.com/replace.php:
 +
 +<code>
 +
 +<?php
 +$rand_char = (rand(0, 100) > 50) ? '!' : '..';
 +echo $_GET['text'] . $rand_char;
 +?>
 +
 +</code>
 +
 +Then add this replacement rule:
 +
 +<code>
 +
 +If this field = URL
 +Contains this value = http
 +Then Search For - * (entire field)
 +in This Field - Alt (Title)
 +And Replace it With - external::http://domain/replace.php?text={ALT}
 +
 +</code>
 +
 +For each imported gallery, the script requests the URL with the actual ALT value. The script receives the response (description with added punctuation) and saves it to the Alt field.
 +
 +**Example 2: Save processed data to a different field**
 +
 +Use the same logic but save the result elsewhere:
 +
 +<code>
 +
 +If this field = URL
 +Contains this value = http
 +Then Search For - * (entire field)
 +in This Field - Description
 +And Replace it With - external::http://domain/replace.php?text={ALT}
 +
 +</code>
 +
 +Now the modified text is saved to the Description field instead of Alt. This flexibility lets you transform data in unlimited ways using custom scripts on your server.
  
  
import_replacements.1391018665.txt.gz · Last modified: (external edit)