Page 1 of 2 12 LastLast
Results 1 to 40 of 53

Thread: Page images

  1. #1
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Page images

    I've made a new extension based upon the xseitenbilder extension. The reason is that a friend of mine tried to contact the author to suggest some improvements but there was no reaction. I have rewritten the entire code and added new functionality.

    This extension allows you to assign images to pages. Suppose the page layout has a place that contains a different image on each page. This extension allows you to create a image category for that location and to assign any image to any nr of pages. You can even assign multiple images to multiple places within one layout.

    Added functionality:
    • Added template choice so multiple images can be assigned with different templates to one page.[/*:m:cccqhjkl]
    • One or more image can be assigned to multiple pages instead of just one.[/*:m:cccqhjkl]
    • When multiple images are selected for one page, they are displayed at random.[/*:m:cccqhjkl]
    • Recursion is used, images now are not limited to 6 levels inside the page structure.[/*:m:cccqhjkl]
    • Images can be scaled automatically.[/*:m:cccqhjkl]

    You can find it here:
    http://www.contao.org/extension-list/vi ... mages.html

    Submit issues and feature requests to the Github repository: https://github.com/Ruudt/contao-page_images

  2. #2
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Also updated today to support random images. You can now select multiple images for multiple pages. The images are displayed at random for each page. Seemed like a logical non-intrusive additional feature.

  3. #3
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    Thats supurb Ruud, and I can see it'll be useful on most sites.

    Couple of things:
    Theres no english label for new
    $GLOBALS['TL_LANG']['tl_pageimages_items']['new'] = array(New Whatchamacallit, 'Create a new Thingamejig');

    Also a bug (I think - maybe I'm not doing it right) - or maybe a request.
    I have a level one menu structure a,b,c,d - and c has level 2 submenus c1,c2,c3,c4,c5 .
    I have pageimages_itemsA to show on b and c.
    I have pageimages_itemsB to show on c3,c4,c5.
    This is all good, BUT pageimages_itemsA ALSO shows on c1 and c2 (which i did not select, or want).

    Also an idea ... a checkbox "add lightbox link to original images" to generate a hyperlink to the full-sized original images, so that clicking the sized thumb opens the image in a lightbox. No biggie, it may not suit, but could be handy.

  4. #4
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Quote Originally Posted by ramjet
    Thats supurb Ruud, and I can see it'll be useful on most sites.

    Couple of things:
    Theres no english label for new
    $GLOBALS['TL_LANG']['tl_pageimages_items']['new'] = array(New Whatchamacallit, 'Create a new Thingamejig');
    Thanks, I've updated the files.
    Quote Originally Posted by ramjet
    Also a bug (I think - maybe I'm not doing it right) - or maybe a request.
    I have a level one menu structure a,b,c,d - and c has level 2 submenus c1,c2,c3,c4,c5 .
    I have pageimages_itemsA to show on b and c.
    I have pageimages_itemsB to show on c3,c4,c5.
    This is all good, BUT pageimages_itemsA ALSO shows on c1 and c2 (which i did not select, or want).
    Actually that is as Contao works with many things; you set a layout and it applies to subpages as well. What I could do (easily) is adding a checkbox "stop recursion" (have to make up a better term). Checking it makes sure dubpages do not inherit the pageimages from the parent.
    Quote Originally Posted by ramjet
    Also an idea ... a checkbox "add lightbox link to original images" to generate a hyperlink to the full-sized original images, so that clicking the sized thumb opens the image in a lightbox. No biggie, it may not suit, but could be handy.
    That setting would apply to the category then, right? Because that is where the size is set as well..
    Just have to be sure to not add too many settings right away, I'm hoping people will start to use my version as it offers more features without adding many fields. (If I recall correctly just 2, technically only 1 because I took one other out as well)

  5. #5
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    I can see keeping it simple is good (its easy to overcomplicate extensions - hey! what if it also had an electic toaster and power-steering)
    The lightbox link is probably not that important but would be useful too show images in their full spendour (and yes.... set in the category where you set size).

    The "stop recursion" I think is important, otherwise you get images showing where you do not want them.
    Better I'd say would be "recurse into subpages", so the default is not to - my reasoning being that it shouldn't do anything you don't ask it to.

  6. #6
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Page images

    [x] Prevent image inheritance

  7. #7
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    The option has been added! I did test, but it kind of uncomfortably worked right from the start; I changed 6 files and way too many lines for it to be without error, yet it functioned as I needed right away. So if anyone could verify it works ok, that would be great!

  8. #8
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    I updated from previous via the extension repository and my computer exploded and my dog died.
    What have you done Ruud? You're in BIG trouble.

    All perfect as far as I can see. It solved my original problem perfectly. Roger Wilco - Over and Out.

  9. #9
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    A couple of bugs found.
    1.No "alt"text is generated for the default image
    2.Choosing a folder for the default image results in
    Uncaught exception Exception with message Directory "tl_files/folder" is not a file thrown in /xxx/system/libraries/File.php on line 86
    This can be solved with 'filesOnly'=>true, added to the eval for defaultimage.

    Now, I really find this extension useful and I'm quite exited really.
    As mentioned, I need it to allow the choice of opening the images in a lightbox, so I've modified it slighty to do so - I added a checkbox for linking in tl_pageimages for each category default image, and checkbox for linking in tl_pageimages_items for each page set.
    I've also set the default image alt to be the category name (probably needs its own alt field, but this'll do for now for me).

    Thats not the exciting bit - this is.
    ga.n has made an extension called [zedseries_metadata], and boy its a beauty.
    http://www.contao.org/extension-list...000003.en.html
    Metadata has always been important to images, and this is just the greatest (don't listen in ga.n :D ) I've found the usual idea of using a metatext file awkward, but with ga.n's you go to the File Manager itself and enter title and description, and its databased so other modules can use it.

    So I've modified yours to use g.an's if it is installed (although only in my lightbox links so that the meta shows in the lightbox, not in the image alt so far).

    The combo of the two extensions allows an alternative to creating galleries (although it does not replace the idea of galleries) and makes adding meta to the images easy.If no meta is set in ga.ns, or the extension is not present ... the native pageimages methods are used.

    Whether or not this inteferes with your concept of [pageimages] Ruud I'm not sure. No functionality is changed, and it doesn't rely on [zedseries_metadata] at all, just uses it if it is present.
    If you want to take a look I can email or link the modified [pageimages] here, i've annotated my changes in each file, and tested it thoroughly.
    If you decide its worthwhile the only things that need doing are take out my comments and the non-english language files need updating to include the checkbox files, and just make this the next version. No credit wanted.
    Oh, and just say whether the meta should be used for the images (not just links) as well and i'll alter the code, or you can.

    If not thats cool, I'll just maintain my own version.

    ps: ga.n - i'll start another thread re [zedseries_metadata], i have a couple of questions for you.

  10. #10
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Quote Originally Posted by ramjet
    A couple of bugs found.
    1.No "alt"text is generated for the default image
    2.Choosing a folder for the default image results in
    Uncaught exception Exception with message Directory "tl_files/folder" is not a file thrown in /xxx/system/libraries/File.php on line 86
    This can be solved with 'filesOnly'=>true, added to the eval for defaultimage.
    Thanks, I'll solve them.
    Quote Originally Posted by ramjet
    As mentioned, I need it to allow the choice of opening the images in a lightbox, so I've modified it slighty to do so - I added a checkbox for linking in tl_pageimages for each category default image, and checkbox for linking in tl_pageimages_items for each page set.
    I've also set the default image alt to be the category name (probably needs its own alt field, but this'll do for now for me).
    I'll address these issues as well
    Quote Originally Posted by ramjet
    So I've modified yours to use g.an's if it is installed (although only in my lightbox links so that the meta shows in the lightbox, not in the image alt so far).

    The combo of the two extensions allows an alternative to creating galleries (although it does not replace the idea of galleries) and makes adding meta to the images easy.If no meta is set in ga.ns, or the extension is not present ... the native pageimages methods are used.
    Can you send me the code? It is cool when these things work together!

    ga.n makes some pretty exciting stuff. Unfortunately his im/ex isn't used much yet...

  11. #11
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    Zipped.Attached.
    As I say, the bugs i mentioned are solved in the files below - the only thing I haven't done yet is use the meta from ga.ns for the thumbnail (non-lightboxed) images[attachment=0:ivo459ph]modified_page_images.zip[/attachment:ivo459ph]

  12. #12
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Hi Ramjet,

    I had some time today to take a look. I have not yet looked at ga.n's extension and I wasn't going to just copy in your code without knowing what it does. So that part is not in.

    What I did differs from your version; I let the module decide if the images are displayed full sized. I don't think you should have to remind to enable or disable it for each page+image instance.

    While at it I added new features as well:
    • I fixed the problem with the default image being a folder by allowing multiple images as the default. They are just displayed at random as expected.[/*:m:z975ssg9]
    • Everything comes from templates now. (Because I wanted to keep in the swf support (never tested) I had to add to separate templates for flash and normal image or drop the "defaultimage" variable)[/*:m:z975ssg9]

    The code is not yet done but I included it for you to look at before I add it to the ER. The new version will not be compatible with the previous one; you need to update the default image for each category because I dropped the fieldname defaultimage...

    Sorry for the messy reply, I'm in a hurry...

  13. #13
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    Thats good Ruud. I think your putting the lightbox ability in the module makes more sense, as does random default images.
    One thing - the default image filetree is now mandatory, but it needs to not be (otherwise I can't have pages without images again).

    Try my version with ga.ns module when you get a chance - you'll see what I mean about it then allowing a great method of having custom titles and descriptions for each image in the lightbox (which could also be used for the alt/title meta and caption if present). The title and description for each image can just be entered directly in the File Manager.

  14. #14
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Quote Originally Posted by ramjet
    Thats good Ruud. I think your putting the lightbox ability in the module makes more sense, as does random default images.
    One thing - the default image filetree is now mandatory, but it needs to not be (otherwise I can't have pages without images again).

    ...
    Did you find any other problems? If not I'll add this version to the ER after checking it. It may need some polishing. I indeed should not require a default, that was a copy-paste bug...

    Quote Originally Posted by ramjet
    Try my version with ga.ns module when you get a chance - you'll see what I mean about it then allowing a great method of having custom titles and descriptions for each image in the lightbox (which could also be used for the alt/title meta and caption if present). The title and description for each image can just be entered directly in the File Manager.
    I'll do this asap. But first need to see how that extension works

  15. #15
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    Did you find any other problems?
    No, all good (i gave it the run, for my needs anyway) Little things - if you choose the same folder twice (pilot errors), it handles fine .
    Maybe reporting back on if default image/default image to the parent/header, lightboxed, etc would be good additions, but logically it works great.

    Also when you do look at ga.ns module - my code to include his module i don't think is positioned correctly. It doesn't need to create a new instance every time, i just get a bit confused around calling other classes. Also the info can be called in the template according to his docs - i haven't used it that way.

  16. #16
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: Page images

    Displaying multiple images per module an idea? Or would that not add anything because the gallery content element does that as well...

  17. #17
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Sorry for the delay. I've added the extension to the ER. Nothing changed from what I uploaded before. Still need to look at ga.ns extension.

    Quote Originally Posted by ramjet
    Maybe reporting back on if default image/default image to the parent/header, lightboxed, etc would be good additions, but logically it works great.
    Can you explain that? I'm not sure what you mean.

  18. #18
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    I just mean that when you first view the category (and/or the category header) it may help to know whether you have a default image selected to show or not (without needing to open the record to find out).

    The reference to lightboxed image was a boo-boo (as you've transfered this to the module level).

  19. #19
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Oh, I see, I could add that as a field in the header. I could make it default image selected: Yes/No. Or should it contain an image preview.

  20. #20
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Page images

    Yes/No would be enough, I think.
    The image would be better - but I'm not sure if you can actually make an image show in the header field.

  21. #21
    New user
    Join Date
    08-18-09.
    Posts
    5

    Default Re: Page images

    Hello there,

    I tried to use this extension on a website I'm working on, but I didn't get it work. I want to use it for the background image. Could someone maybe explain me in detail what I have to do? Where do I have to put the module?

    Thanks and greetings,

    Helena

  22. #22
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Helena, To get it to display as a background-image you'd need to create your own template that inserts CSS information into the page template.

    To do this inside the TL_ROOT/templates folder create a file that you call pageimages_yournamehere.tpl. Inside that file you add the style information that you want. Make the module use this template.

    The example below sets the body background to the bg image. You can use any html code that you want.
    Code:
    <style type="text/css" media="screen">
    body {
    	background-image: url('<?php echo($this->img); ?>');
    }
    </style>
    Let the module use the correct template

    You'd best add it to your head section inside the layouts that should have the background, but any place inside the structure will work as well...

  23. #23
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Page images

    you can also put the style in the TL_HEAD array:
    Code:
    <?php
    $GLOBALS['TL_HEAD'][] = '<style type="text/css" media="screen">
    body {
       background-image: url(\''. $this->img.'\');
    }
    </style>';
    ?>

  24. #24
    New user
    Join Date
    08-18-09.
    Posts
    5

    Default Re: Page images

    Thanks a lot for your advices.
    But unfortunately it still doesn't work.

    That's what I did step by step (after installing):

    1. I added a new category with a default image.
    2. I added some page images with corresponding pages.
    3. I copied the template for the css background and called it pageimages_css_background.tpl.
    4. I added a module with the template connected to it.
    5. I added the module to my page layout into the section where I need the image.

    Finally I can see this in my HTML:
    Code:
    // Copy this template to the TL_ROOT/templates directory and edit to fit your needs
    // Default image properties are available singleSRC, arrSize, alt and so on...
    <style type="text/css" media="screen">
    body {
    	background: url('') no-repeat !important;
    }
    So somehow the URL to the image is missing.

    Can someone help me with that?

  25. #25
    New user
    Join Date
    08-18-09.
    Posts
    5

    Default Re: Page images

    OK, I found it out myself by using
    Code:
    <?php $this->showTemplateVars(); ?>
    The example template for background css is wrong. This will work instead:
    Code:
    <style type="text/css" media="screen">
    body {
    	background: url('<?php echo($this->src); ?>');
    }
    </style>
    Maybe you can change that in your extension.

    Greetings, Helena

  26. #26
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    I've updated the template. A lot has been changed and I forgot I removed that variable. Also, I've adopted Thyon's suggestion. Thanks for that. But that template is just an example because it'll probably never be the exact thing someone needs.

    Any more bugs?

  27. #27
    New user
    Join Date
    06-22-11.
    Posts
    5

    Default Re: Page images

    Hi

    I have problem using flash. When i select images everything is working properly but after selecting .swf i have source code as follow:
    Code:
    <div class="image_container">
    [img][/img]
    </div>
    I can't find template to embed swf.

    sincerelly
    gutenbergus

  28. #28
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Quote Originally Posted by gutenbergus
    Hi

    I have problem using flash. When i select images everything is working properly but after selecting .swf i have source code as follow:
    Code:
    <div class="image_container">
    [img][/img]
    </div>
    I can't find template to embed swf.

    sincerelly
    gutenbergus
    The extension of that file is .swf in all lower case? Are you using the latest version? Then the pageimagesflash.tpl template file should be chosen. I'll look at it tonight.

  29. #29
    New user
    Join Date
    06-22-11.
    Posts
    5

    Default Re: Page images

    i'll give You acces to my website with pleasure, on priv of course :D

  30. #30
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Didn't get around looking at it. Second try tonight. I don't know if I need access if the problem is in my code But couldn't hurt.

  31. #31
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    I fixed it and it is in the ER. Let me know what you think. The new templates by default stretches the flash movie to the dimensions set, that way it sort of behaves like the flash variant of cropping images (can't do that so I distort the flash to fit).

    One note: To get flash to work you need to add swf to the "Image file types" setting of your Contao setup.

  32. #32
    New user
    Join Date
    06-22-11.
    Posts
    5

    Default Re: Page images

    Well, its much better, because something happens. But i still dont get template for flash. Creating new module i see only pageimages_default and pageimages_css_background_example templates. Next thing: width and height did'nt work they are empty in code. And last, maby it would be better to use mootool to embed flash then <object> or <embed> tags? What You think?
    Andrzej

  33. #33
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Quote Originally Posted by gutenbergus
    Well, its much better, because something happens. But i still dont get template for flash. Creating new module i see only pageimages_default and pageimages_css_background_example templates. Next thing: width and height did'nt work they are empty in code. And last, maby it would be better to use mootool to embed flash then <object> or <embed> tags? What You think?
    Andrzej
    There is no backend selectable flash template. But you can override the html if you copy the flash template (pageimagesflash.tpl) from the pageimages/templates dir into your TL_ROOT/templates dir. Then you could also use mootools if you'd like. But the method I tried now works with the 4 major browsers on my pc, so I see no good reason to use javascript for something html can handle. Any good reason might change my mind though...

    The reason there is no flash template that you can select is because you can mix images and flash files. I could add the option, but already thought about that before. I didn't do that because; the code is very generic, there are very few reasons to change it per module. But also Contao uses just about the same method for templates and subtemplates, must be a good thing? And finally; I'd needed to add two fields, one for images and one for flash, I thought to keep the extension as simple as possible. And in the end; you CAN change the templates with little manual labor.

    Width and height worked for the flash file I tried, but I read the Gd lib that reads the dimensions might have problems on flash files. Can you post your file, so that I can check?

  34. #34
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Next version coming up!
    I'm currently testing the next version. I've refactored the code; I built the extension from an existing one and hadn't changed all of the algorithms.

    I've added two new modules:
    • Page images navigation
      For example useful when each page has an icon in a menu. But I used it to display subcategories in a webstore, each with an image.
      [/*:m:1fts41hb]
    • Page images custom nav
      More or less the same except you van choose the pages to display per page as the original module.[/*:m:1fts41hb]


    If anyone has any requests... Now would be a good time!

    <edit>
    I've added the categories to the permissions so categories can be limited to users and groups
    </edit>

    Cool, I want it, when?
    I'm trying out an alternative page structuring which I incorporated into pageimages; it reduces the database calls to retrieve all ancestors in the correct order, joined with the images associated to just 1 query. Which is super efficient, but I do not know yet if this system is stable enough. As soon as I figure out if it is I will release it with the tree structure change (separate extension so others can use it as well!), otherwise I'll release with a traditional recursive tree traversal function as the current version has...

  35. #35
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    I've just released the new version! I'm pretty excited about it because it features a new extension that adds navigation modules!

    http://www.contao.org/extension-list/vi ... mages.html
    http://www.contao.org/extension-list/vi ... ation.html

    I released them as RC because I changed a large amount of the code and was a bit nervous about calling it stable although I haven't had any trouble with it.. Can someone confirm it works well?

  36. #36
    New user
    Join Date
    02-21-12.
    Posts
    2

    Default Re: Page images

    Hello community,
    after the update to 2.11.0 i got problems with [page_images] 1.3.0 ...

    When i work on an item in the backend (f.e. adding an image and a corresponding page to a categorie) , i will get following error:
    Code:
    Warning: Illegal offset type in isset or empty in /var/customers/webs/fischer/alysion.net/kraus/system/drivers/DC_Table.php on line 2750
    
    #0 /var/customers/webs/fischer/alysion.net/kraus/system/drivers/DC_Table.php(2750): __error(2, 'Illegal offset ...', '/var/customers/...', 2750, Array)
    #1 /var/customers/webs/fischer/alysion.net/kraus/system/drivers/DC_Table.php(1624): DC_Table->getPalette()
    #2 /var/customers/webs/fischer/alysion.net/kraus/system/modules/backend/Backend.php(282): DC_Table->edit()
    #3 /var/customers/webs/fischer/alysion.net/kraus/contao/main.php(120): Backend->getBackendModule('pageimages')
    #4 /var/customers/webs/fischer/alysion.net/kraus/contao/main.php(230): Main->run()
    #5 {main}
    five times , no further content. The changes are saved anyway, everthing works fine in the frontend!!

    Is there anyone having the same problem? Or some hint for finding a solution?

    Greeting,
    Markus

  37. #37
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    Fixed in 1.3.1.

    I got the same issue with 2.10.4 though. But I am unsure if this is actually a new issue (I did not test that). It only happens when you did not select any pages for a pageitem. An onload function returned an empty serialized array instead of null for new items. Because of the wrong value Contao did not enforce pages being a mandatory choice and a different piece of code expected an array with at least 1 item. I fixed the bug at both places to make sure updates work as well without trouble.

  38. #38
    New user
    Join Date
    02-21-12.
    Posts
    2

    Default Re: Page images

    Thank you for the update. I am almost sure, that I had chosen a page for every item...
    Anyway: Now, it work perfectly again :D

  39. #39
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Page images

    I've added a Contao 3 compatible version. Compatible with the current beta1. Any feedback much appreciated as I've changed a lot to use new DAFS and what not.

    Page images extension

  40. #40
    New user
    Join Date
    04-24-13.
    Posts
    2

    Default Re: Page images

    Hi,
    I am currently testing Version 3.0.0 beta1 with Contao 3.1 RC1. Works fine except of one thing: When selecting more than one page in the page selector and saving the entry, only the first selected page is remembered. All other pages are dropped.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •