Skip to content

Insert ramdom image at random location of article from local machine/HDD

currently we have 2 options to insert a random image into article:

1. by violating international copyright law and using image search or image sites
to insert a random image at a random location inside an article

2. by hard-coding into article at fixed location a random image from own machine

desirable would be to ADD a feature to insert from OWN machine (=local path) a random image at RANDOM location of article instead of hard coding random image path into fixed location of article


  • SvenSven
    edited September 2013
    On next version you can use something like:
    result=<img src="%spinfolder_data_url-c:\some\folder\with\images\%" style="max-width:500px;"> content_search.dat (remove all other engines than).
  • @sven
    that is a great new feature, one small problem left:

    I have fix image sub-folders named by keywords with pictures for different projects / niches
    and the file "content_search" is a global configuration valid for ALL SER projects ...

    How do I define in that "content_search" which sub-folder of images to choose for random images for a particular project or tiers ??
  • SvenSven
    @hans51 on next version you can sue %search% in the result string which should hold your anchor text or keyword. result="<img src="%spingfolder-c:\images\%search%\%">"
  • edited September 2013
    fail to understand your point

    does it mean I have to use desktop search and search for the sub-folder on my HDD containing the pics for a particular photo-category = where the folder-name=keyword for search ??

    or is there a possibility to create/define a variable and create multiple entries

    result=<img src="%spinfolder_data_url-c:\some\folder\with\images\%" style="max-width:500px;">

    = where [local_images_to_data_url] can be assigned a variable to select a particular sub-folder of images matching a particular project / article-topic ??
    [local_images_to_data_url variable1]
    [local_images_to_data_url variable2]
    [local_images_to_data_url variable3]

    and each such definition points to a different relevant image-folder ..
  • SvenSven
    just use my result string from above. It will look into the sub folder that should look the same as your keyword.
  • edited September 2013
    does folder-name AND image names to  be or to contain keyword in filename or file-name string ??
    only folder-name = keyword ??
    and image name ANY name?
  • SvenSven
    Just the folder as the spinfolder macro is taking a random file from there.
  • @sven
    does SER take the keyword for image search from keywords defined in project / tiers
    from actual keywords found in article ?
  • SvenSven
    It takes the %tag% here. That can be the keyword or the anchor text used in the article depending on your project options.
  • tks for clarification
    all OK now
  • edited September 2013
    my content_search.dat contains:
    ;edit this to your needs

    ;this could be used to take a random image from a folder
    result=<img src="%spinfolder_data_url-d:\Dropbox\images\%" width="3{0|1|2|3|4|5|6|7|8|9}{0|1|2|3|4|5|6|7|8|9}" height="2{0|1|2|3|4|5|6|7|8|9}{0|1|2|3|4|5|6|7|8|9}" align="{left|right}">

    I selected to insert up to : 1-2 images in project settings, but max 1 image is inserted. There are also a lot of posts without images even if I selected to insert min1, max2 images. Can you please check?

    In some posts the image is not inserted properly, the html code appear instead of the image:

    or the image don't appear at all, instead a white box appear:
  • @Sven Let me know when to start testing again :) I can't use this yet
  • the base64 code as well as html code for links is also appearing in many of my posts on drupal blogs,
    seems to be normal on drupal - NOT all but many.
    in my most recent drupal blog posts there normally is nothing = no pics and no empty space at all

    for myself, I haven't seen a single random image AT ALL on any type or article site since changing new code
    there are very few site-types anyway that allow pics even before when i had pics hardcoded
  • SvenSven
    Well all the samples above either do not allow the usage of the things or modify it. I have changed things for next update to not use data urls in drupal engine as @hans51 suggested. I think it's more save to not use it when the majority of sites do not allow it.
  • YES that seems the case
    either no images at all on drupal
    or data

    if base64 code published on drupal, then also html code for links

    if NO base64  code published on drupal,  then correct links with anchor
  • That's fine with me!
  • @sven
    here is an example of how drupal garbles a submission with html code and LINKS cut = wrong links or 404

    in THIS case no base64 code for images but all HTML img code

    that behavior of cutting LINKS I have seen only on drupal so far, but relatively often (may be half of all articles
  • SvenSven
    OK this is fixed in upcoming version (without tests though).
  • @Sven I have to manually edit content_search.dat every time you update the software. Is there a way to lock for updates this file?

    I forgot to edit it after your last update and I ended with children pictures in my adult posts!
  • SvenSven
    Next version will ask you to overwrite it or not.
  • @sven
    testing since available and many drupal included
    so far ALL looks perfect
    clean URL-links many times better than broken links before

  • @Sven You can remove it from the engines below too
    wordpress article
  • SvenSven
    @Ovidius sorry but remove what in those engines?
Sign In or Register to comment.