Jump to content

Separate field for thumnails


dhruba
 Share

Recommended Posts

Not sure if I understand correctly ;)

Just make as many thumbnails as you want from an image field. If you store the thumb separate, you have to manage two fields with the same data = bad.

// Make a thumbnail 100x80 px from a field called $image
$thumb = $page->image->size(100,80);
echo "<img src='{$thumb->url}' alt='blub'>
  • Like 2
Link to comment
Share on other sites

Maybe you are referring to avatar type images for admin users? In that case, you can add an images field to the user template. It might be best to limit it to one image, so it that case you would want a new image field as the one that comes with the default profile allows multiple images.

Are either of us on the right track with your question?

  • Like 1
Link to comment
Share on other sites

Thanks

I am also confuse how to link to pages like I have a template / page authors (separate from users) and another templates / page for topics and replies and I want to track no of topics / replies by authors and and when I delete a author I want delete all topics / replies post by that author.

Thanks.

Link to comment
Share on other sites

Ok, if you are setting up a page tree of front-end page authors (that are not PW admin users), then I would suggest a page tree like:

Authors (template: authors)

--John Smith (template: author) 

--Mary Brown (template: author) 

The author template could have your portrait image field for each author along with other details about them.

Not sure how they are authoring these pages, but presumably through a front end form?

As the author creates the page, just assign their ID to the page in an author field.

To delete an author and have all their pages deleted could be done easily through the API by using a selector to grab the array of pages with the appropriate author and foreach'ing through, deleting each one. This very rough idea would set all the pages with the assigned author to unpublished. If you want you could obviously delete instead.

foreach($pages->find("author=ID") as $selected_page){
    $selected_page->addStatus(Page::statusUnpublished);
}

You might want to do this through the admin by setting up a special page. You could create a simple module, or make use of diogo's http://modules.processwire.com/modules/process-admin-custom-pages/ module - it is really cool for things like this.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...