Jump to content


Photo
* - - - - 1 votes

Articles and images


  • Please log in to reply
10 replies to this topic

#1 omarf

omarf

    IPB Newbie

  • Visitors
  • Pip
  • 38 posts

Posted 09 February 2012 - 10:58 AM

Is there a better way to add and control images in articles (content) than what's available in the demo?

Article image adds a single image to the article with no position or size control. Adding an attachments field to the articles improves this slightly, but still provides no control over image size or positioning.

Neither option provides for captions.

Some of this could be addressed globally with CSS, but can I have better control over images in the article editor, similar to what's available in WordPress, for example?
  • smoorbwrari likes this

#2 bfarber

bfarber

    RBT-KS

  • IPS Management
  • 28,676 posts

Posted 09 February 2012 - 01:50 PM

Yes, with a little effort. Anything is possible, realistically, however not everything is possible with the flip of a switch or the toggle of a setting out of the box.

By default we use a single file upload field restricted to images to represent the article image. This allows for a lot of various interconnected functionality (such as showing the article image in frontpage and archive listings - something that is difficult to do when you utilize an attachments field and there could be 10 files uploaded, none of which are images). This is a basic file upload field that does not let you specify various parameters by itself.

However, you can control both positioning and size by editing the appropriate templates. For instance, to change how articles are displayed, you would edit the Article Templates -> "Article View" template. When doing so, find the code

<if test="$data['record']['article_image']">
            <img src='{$data['record']['article_image']}' {parse resize_image="$data['record']['article_image']" maxwidth="225"} alt='' style="float: right; padding: 10px" />
        </if>

If you wanted the image on the left instead of the right, change the float CSS to left. Or if you wanted it above the article, get rid of the float and wrap the image in a <div> (which you could then center for instance). Or cut this code out of the template and paste below the rest of the fields to move the article image to the end. Ultimately, it is a template and you have complete control to customize it.

Similarly, here you will see a maxwidth value of 225. You could change this, or you could even embed some PHP code to proportionately resize the image if you wanted. There are many options, depending on your level of comfort with modifying the templates, coding PHP, understanding our HTML logic, etc. As I said, anything is possible. :)

Brandon Farber
Development Manager / Senior Support

If it sounds like fun, it's not allowed on the bus!

php5_zce_logo_new.gif     

Invision Power Services, Inc.


#3 omarf

omarf

    IPB Newbie

  • Visitors
  • Pip
  • 38 posts

Posted 09 February 2012 - 04:11 PM

Thanks, I've made some changes to the demo template and I can make it work.

Next: what to do when I want to publish an article with multiple images, say 20...?

I guess I need to find out if the IP.Content editor will support a more flexible article creation in some future iteration and allow me to create an article with one or twenty images just as easily.

An additional concern with making template modifications is compatibility with future upgrades.

What I'd really like to see is a content publishing system closer to what Joomla or WordPress offer. Not all of their bells and whistles are necessary, but at least the added flexibility for editing articles and images.

#4 bfarber

bfarber

    RBT-KS

  • IPS Management
  • 28,676 posts

Posted 09 February 2012 - 07:43 PM

What I would do if you want more images is to leave the existing article image uploader in place, and then add an attachments field (as you've apparently tested) in addition to it. Then whatever image is uploaded via the article image single upload field represents the article, but additional images (or any other files really) can be uploaded as well, should there be a need.

Brandon Farber
Development Manager / Senior Support

If it sounds like fun, it's not allowed on the bus!

php5_zce_logo_new.gif     

Invision Power Services, Inc.


#5 omarf

omarf

    IPB Newbie

  • Visitors
  • Pip
  • 38 posts

Posted 09 February 2012 - 07:56 PM

Thanks.

What about captions?

And are there any plans to add some of these capabilities to the editor?

#6 bfarber

bfarber

    RBT-KS

  • IPS Management
  • 28,676 posts

Posted 10 February 2012 - 09:31 AM

IP.Content makes use of the editor from IP.Board, and as such is limited to the capabilities of the editor as used in IP.Board. I believe there are third party addons (either released, or in the works - I've read about people doing this in the feedback forums) to give you a full ckeditor when submitting articles, which would give you some more options.

As for captions, you could create a custom bbcode for that I imagine, or create a new field in the Manage Fields area, and then just be sure to update the template to specify where that field should show (if you don't, it will show at the bottom of the article body). There are certainly ways to implement a caption at present, it just requires a little setup first.

Brandon Farber
Development Manager / Senior Support

If it sounds like fun, it's not allowed on the bus!

php5_zce_logo_new.gif     

Invision Power Services, Inc.


#7 omarf

omarf

    IPB Newbie

  • Visitors
  • Pip
  • 38 posts

Posted 10 February 2012 - 02:22 PM

I saw that you can select the CKEditor in the template editor settings and I wonder why it hasn't been ported to the story editing?

#8 bfarber

bfarber

    RBT-KS

  • IPS Management
  • 28,676 posts

Posted 10 February 2012 - 09:02 PM

Allowing free-for-all HTML submissions on the front end is a security issue, so more consideration is needed for the front end.

Brandon Farber
Development Manager / Senior Support

If it sounds like fun, it's not allowed on the bus!

php5_zce_logo_new.gif     

Invision Power Services, Inc.


#9 omarf

omarf

    IPB Newbie

  • Visitors
  • Pip
  • 38 posts

Posted 11 February 2012 - 11:04 PM

Article creation and editing isn't part of the front end, is it?

#10 bfarber

bfarber

    RBT-KS

  • IPS Management
  • 28,676 posts

Posted 13 February 2012 - 09:33 AM

If you allow it, it is. You can control which permission masks can submit articles (and edit articles) from the front end in the ACP. If you disabled front-end submissions completely, then allowing free-form HTML would be much less of an issue obviously (since only administrators, whom you have presumably vetted already, will be the only ones who can submit the HTML).

Brandon Farber
Development Manager / Senior Support

If it sounds like fun, it's not allowed on the bus!

php5_zce_logo_new.gif     

Invision Power Services, Inc.


#11 omarf

omarf

    IPB Newbie

  • Visitors
  • Pip
  • 38 posts

Posted 13 February 2012 - 09:48 AM

Yes, that would be my case - only editors could create articles.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users