This project is read-only.

Pointers to Image files placed in body part don't move between environments

Topics: Customizing Orchard
Sep 20, 2012 at 1:41 AM

I have some pages and blog posts where I embed an image in a body part.  In some of these embedded images I have a url link set up.  I have my environment set up so that when I make changes, I make the changes in a development environment using Visual Studio.  When I move the web site folder from my development environment to staging.  I am using Dropbox to move the changed files to the staging server, then copy the whole folder to my staging folder on that server.   I then move to Webmatrix to test that everything moved as expected.  When it all looks good, I publish to production using Webmatrix on the staging server.

This approach seems to work really well, since both Dropbox and Webmatrix are good about only moving things that changed and the folder copy on the staging server gives me a good fallback in case some unexpected change on the dropbox side occurs.  

The only problem I seem to be having with this approach is that pointers to the images in body parts don't resolve back to the image files when the folders are moved.  I end up with empty rectangles where the images are supposed to be.

I can rectify this by running Orchard in the new location as administrator, editing the pages, deleting the empty rectangles and re-establishing the image pointers.  This can be a bit of a pain because:

1. Sometimes the image embedder won't go to the level of detail I need to access the image and I need to delete it from its location and re-upload it. 

2. If the image has a link associated with it, I need to re-add that link.

These actions have to be performed twice per image in each move, once when the programs are moved to staging (if I want a complete test) and once again when it moves to production.  In general it somewhat defeats the purpose of have development and staging environments, as I can't lock changes at the development point.

We kicked this problem around briefly in the code club meeting on Monday and by looking at the properties on the image placeholders, found that they still contained localhost in their path.   I haven't tracked down all the details, but it appears related to that.  There is apparently a workaround to this problem in the Vandalay module somewhere that I guess will find all these errant pointers and fix them. 

But before I go messing with that, I wanted to see if a better solution exists, specifically one that enables me to lock changes in the development environment before moving the folders to staging.  Once they are in staging, they should not be modified at the administrator level.

Thanks - any advice appreciated.


Sep 20, 2012 at 2:14 AM

No. Just configure your dev environment exactly like your production environment and links and image pointers will be portable. If anything inserts fully-qualified paths with the domain included like you seem to imply, that would be a bug but I've never seen that happen with current builds.

Oct 1, 2012 at 12:50 AM

Sorry - I had a busy a week and needed some time to re-create this one.   You can see it in this screen shot:

The page and file properties on the left are from my development system.  The pair on the right are on my QA system. 
The development system is VS2012 and the QA system is running in webmatrix.

The two systems are connected via dropbox, and the only thing that moves between them are changes.  This is the only
thinkg that doesn't move correctly in my applications.

Hopefully it's me, but I cannot see what could be wrong.


Oct 1, 2012 at 1:45 AM

Is the media folder correctly replicated?

Oct 9, 2012 at 4:02 PM

The media folder looks correctly replicated.   I changed the setup of the source side so both sides would be replicating to the exact same location:

 Directory of C:\Orchard_Distribution_Dropbox\Dropbox\Powerfinger_CMS\src\Orchar

09/30/2012  05:51 AM    <DIR>          .
09/30/2012  05:51 AM    <DIR>          ..
09/30/2012  05:35 AM             1,388 pf_myspace_dude_reasonably_small.gif.png
               1 File(s)          1,388 bytes
               2 Dir(s)   4,134,178,816 bytes free

Folders are identical on both source and target.

Oct 9, 2012 at 4:17 PM

Please view the html source from the content item editor on both sides and post the faulty image tag for both sides here.

Oct 9, 2012 at 10:31 PM

Here is the html for the source side (ie, the good side):

<p>Log in to Orchard here</p>
<p><img src="/OrchardLocal/Media/Default/Page/pf_myspace_dude_reasonably_small.gif.png" alt="" height="72" width="72" /></p>

Here is the html for the target side (ie the faulty side):

<p>Log in to Orchard here</p>
<p><img alt="" src="/OrchardLocal/Media/Default/Page/pf_myspace_dude_reasonably_small.gif.png" width="72" height="72" /></p>

Oct 10, 2012 at 12:58 AM

OK so it seems like those images were inserted when the dev box was configured to run on /OrchardLocal. I'm afraid you'll have to manually fix them, or write a script that does it for you. A simple SQL script that does a replace of "/OrchardLocal/ to "/ may do the trick.

Oct 10, 2012 at 3:22 AM

OK - I think I follow that and can fix my existing stuff.  But, is there a way to configure the dev box so it is not running on /OrchardLocal so the condition doesn't continue to occur?  Thanks

Oct 10, 2012 at 5:06 AM

Of course, it's in the ORchard.Web project settings.