Content Image not working after upgrade to 2.2.1

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am
Location: Sydney Australia

Content Image not working after upgrade to 2.2.1

Post by Simon66 »

I upgraded a site from 2.1.6 to 2.2.1.
My page template includes a Content Image:

Code: Select all

{capture assign='contentimage'}{content_image block='Content Image' dir='images/Gallery/content_images' urlonly='1' exclude='thumb_'}{/capture}
If I choose a Content Image in a page of the Content Manager (very cool new file picker BTW) and submit the changes, there is no image on the front end.

Then I open the page again in the Content Manager and there is a '0' in the Content Image field.

Cheers
Simon66
Attachments
contentimage.png
scooper
Forum Members
Forum Members
Posts: 242
Joined: Fri Dec 09, 2005 12:36 pm
Location: Marlow, UK

Re: Content Image not working after upgrade to 2.2.1

Post by scooper »

We had something similar when we upgraded a site.

It looks as if in the old dropdown image selector the default was '-1' and in the smart new image picker it's '0' if there was no image selected
In our template we were looking to see if the image wasn't -1 and then displaying it if not which not longer worked.

Now that's slightly different to your case where the image doesn't appear to be being saved but we also use a slightly different method of accessing the image so maybe that's changed too.

The code that works for us at the moment is:

Code: Select all

		
{assign var=banner_image value=$content_obj->GetPropertyValue('image')}
		{if !empty($banner_image) && $banner_image ne -1}
show the image or whatever.
{/if}

Give that a go and see if it helps.

s.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Content Image not working after upgrade to 2.2.1

Post by Rolf »

I noticed this too with regular content blocks. Looks like a change in Smarty... Block names doesn't allow spaces anymore.
{content_image block='Content Image' ...}
should become:
{content_image block='Content_Image' ...}

But don't change the code in the template, first keep both tags in there! Otherwise you might lose your settings/content.

Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am
Location: Sydney Australia

SOLVED: Content Image not working after upgrade to 2.2.1

Post by Simon66 »

Thanks Scooper and Rolf,
I first tried changing the block name suggested by Rolf as it was the simplest change and it worked.
I had to add the label but it works perfectly now.

Code: Select all

{capture assign='contentimage'}{content_image label="Content Image:" block='Content_Images' dir='images/Gallery/content_images' urlonly='1' exclude='thumb_'}{/capture}
Cheers
Simon66
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Content Image not working after upgrade to 2.2.1

Post by Rolf »

Code: Select all

{capture assign='contentimage'}{content_image label="Content Image:" block='Content_Images' dir='images/Gallery/content_images' urlonly='1' exclude='thumb_'}{/capture}
A bit shorter and easier to process:

Code: Select all

{content_image label="Content Image:" block='Content_Images' dir='images/Gallery/content_images' urlonly='1' exclude='thumb_' assign='contentimage'}
I personnaly prefer:

Code: Select all

{$contentimage = "{content_image label='Content Image:' block='Content_Images' dir='images/Gallery/content_images' urlonly='1' exclude='thumb_'}"}
Because you can add more parameters afterwards, i.e.:

Code: Select all

{$contentimage = "{content_image label='Content Image:' block='Content_Images' dir='images/Gallery/content_images' urlonly='1' exclude='thumb_'}" scope=global}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Simon66
Power Poster
Power Poster
Posts: 250
Joined: Wed Aug 29, 2007 4:36 am
Location: Sydney Australia

Re: Content Image not working after upgrade to 2.2.1

Post by Simon66 »

Thanks Rolf,
The only reason I did it the old way is because it's the one I learned when I started using CMSms.

I will add your preferred method to my tool kit.

Cheers
Simon66
Locked

Return to “[locked] Installation, Setup and Upgrade”