Git Product home page Git Product logo

featured_image's Introduction

featured_image

Note: This plugin will be officially included in Zenphoto 1.6.3. This repository therefore will not get any further updates and will be deleted once 1.6.3 has been released.

A Zenphoto plugin to attach an image from the gallery to a Zenpage article, category or page as an "featured image". You can use this image for example for headers of your single article/page/category pages or within the news article list as a thumbnail.

The benefit compared to the embedding an image within the text content statically is that you can control the size of it via your theme's layout dynamically as with gallery items.

Put the file featured_image.php and the folder of the same name into your /plugins folder. Your theme requires support for it. To use it you need to modify your theme used if it has no built in support already.

Usage examples:

a) Object model

$featuredimage = getFeaturedImage(<object of the Zenpage item>);
if($featuredimage) { // if an feature image exists use the object model
  ?>
  <img src="<?php echo pathurlencode($featuredimage->getThumb()); ?>" alt="<?php echo  html_encode($featuredimage->getTitle()); ?>">
  <?php
}

b) Theme function for pages.php and news.php for the current article, category or page

<?php printSizedFeaturedImage(NULL,'My featured image',500); ?>

Requirement: Zenpage CMS plugin and a theme supporting it

License: GPL v3

featured_image's People

Contributors

acrylian avatar

Watchers

 avatar  avatar  avatar

featured_image's Issues

makeImageCurrent($thumb) breaks page

Probably due to my lack of skills...

The only way I can get an image to show is to use something like this:

$thumb = getAttachedArticleAlbumThumb($_zp_current_zenpage_news);
if($thumb) {
makeImageCurrent($thumb);
printCustomSizedImageThumbMaxSpace($alt='',300,300,$class=NULL,$id=NULL);
}

This works fine within the next_news() loop but if I use this somewhere in the single news
(after if(is_NewsArticle())), the page breaks as soon as I use makeImageCurrent($thumb)

Question:
Does an album thumb needs to be set for this to work or does it use the first image in an album ?

Scale admin thumb

Hi Malte,

Please get this plugin in the core. :)

Seems to work good with 1.4.6, no issues as of yet. Suggestion - add the following to the css file so the image thumb scales in the admin column:

#fi_adminthumb img  {
    max-width:100%;
    height:auto;
}

image

Usage examples in comments of featured_image.php

In the "Theme function" example, the printSizedFeaturedImage() function is missing the first parameter.
It needs to be either NULL or an object.

I think it should be:

b) Theme function for pages.php and news.php

Other than that it's working great !

Question: adopt this plugin for ZenPhoto20

Hi Malte,
could you create a version which works with ZP20 too? My capabilities are not good enough to do it by myself.
Thanks for your support and best wishes,
Jens

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.