We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17249 ☆ A M B ☆
    • 165 Posts
    I still haven’t found a solution for this. Using 2.1.1
    Can someone make a simple test and try to crop from top and show the snippet call?
    [[*image:phpthumbof=`w=420&h=160&zc=T&f=jpg`]]
    

      • 23018
      • 353 Posts
      As far as I understand the only way to clear the cache is to use the "OnSiteRefresh" event which is triggerd any time I hit the "clear cache" button. As a result the COMPLETE image cache is cleared.

      From time to time one of my clients re-uploads some of his images. The filenames remain unchanged, but the content is different. This causes an intersting problem: The new images is not rendered by phpthumbof because it is already inside the cache.

      As a quickfix I added a bit of code to the phpthumbof snippet that would overwrite the thumbs of any page that is viewed by somebody logged into manager.

      This frees a manager user to do the clear cache routine just to upgrade a cached image.

      BUT I don’t like that solution

      It works, but it puts unnecessary stress on the server because the fact that a page is viewed by a manager user doesn’t mean that he actually changed images on that page.

      Better, but still not perfect would be to ask MODX if said page was changed (saved) in the last X seconds.

      I could also imagine using a TV checkbox "clear cached images" to execute this behaviour. You could activate it, then safe the document and afterwards view the document. The script could check for those parameters and overwrite the cached images of this document.


      Each one of these solutions has its pros and cons. I’m not sure how to proceed so I would like to do some brainstorming before I continue.


      Any recommondations?

      Kind regards,

      pepebe
        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
        • 16702 ☆ A M B ☆
        • 536 Posts
        Hello, ALL,

        maybe question is with simple answer, but how can i change default path of cache?

        dafault is:

        assets/components/phpthumbof/cache/2978f87a02c2a9236bd22ac69856c87a.e610e04badaa47081149f7440b9ae825.jpg" />


        i try with setting_phpthumbof.cache_path but i have no results...

        i want my path to be something like this:

        images/cache/2978f87a02c2a9236bd22ac69856c87a.e610e04badaa47081149f7440b9ae825.jpg" />



        P>S> Revo 2.1.2 and phpthumbof 1.2.1
          palma non sine pulvere
          • 16702 ☆ A M B ☆
          • 536 Posts
          how can i set EXPIRATION for images which generatet from PhpThumbOF:

            palma non sine pulvere
            • 23018
            • 353 Posts
            Quote from: Kristalin at Jul 27, 2011, 02:35 AM

            how can i set EXPIRATION for images which generatet from PhpThumbOF:



            Please be more specific. do you want to have individual expiration dates? Do you want images to expire after n weeks...

            Regards,

            pepebe

            Edit: Oh, I got you wrong. We are talking about client side expiration, don’t we? This is releated to header information and not not directly related to phpthumbof.

            You can set expiration parametes with your .htaccess file.

            http://httpd.apache.org/docs/2.0/mod/mod_expires.html

            will give you some advice on that topic.

            I’d have to dig into that topic to give more meaningful advice, but I hope this is helpful anyway.
              Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
              • 18463
              • 121 Posts
              Martijn van Turnhout Reply #56, 15 years, 2 months ago
              I’ve been using this .htaccess rule for quite some time now

              <FilesMatch ".(htc|ttf|woff|eot|svg|flv|gif|jpg|jpeg|png|ico|swf|pdf|mp3|avi|mov|ppt|doc|wmv|wav)$">
                Header set Cache-Control "max-age=604800"
              </FilesMatch>
              


              Feel free to modify it!
                • 16702 ☆ A M B ☆
                • 536 Posts
                Hello, Martijn van Turnhout and pepebe,

                your advice is work perfect, but i have one more question:

                Quote from: Kristalin at Jul 24, 2011, 10:02 AM

                Hello, ALL,

                maybe question is with simple answer, but how can i change default path of cache?

                dafault is:

                assets/components/phpthumbof/cache/2978f87a02c2a9236bd22ac69856c87a.e610e04badaa47081149f7440b9ae825.jpg" />


                i try with setting_phpthumbof.cache_path but i have no results...

                i want my path to be something like this:

                images/cache/2978f87a02c2a9236bd22ac69856c87a.e610e04badaa47081149f7440b9ae825.jpg" />



                P>S> Revo 2.1.2 and phpthumbof 1.2.1
                  palma non sine pulvere
                  • 7966
                  • 90 Posts
                  I think I should have posted the question here instead of other forum section, - http://ttyl.modx.com/thread/69739/phpthumbof---what-to-do-to-make-it-work-from-another-context#dis-post-391163

                  I couldn't make the phpthumbof work from another context. It works from "web" context.

                  When I check the errors, function looks for image file in main modx path, instead of under the context domain file path.

                  I tried a couple of things from reading other threads.

                  * changed the "phpthumb_document_root" to context domain path "/var/www/html/main/context_1"

                  * changed "phpthumbof.cache_path" as "/var/www/html/main/context_1/assets/components/phpthumbof"

                  * changed "phpthumb_allow_src_above" to yes in system settings area

                  * added "filemanager_path" for context as "/var/www/html/main/context_1"

                  * added "filemanager_url" to "http://www.domain.com/"

                  Any ideas what else I can try?

                  Thank you

                    • 7966
                    • 90 Posts
                    I made it work finally. In case anyone encounter same problem,:

                    phpthumbof was returning a path like that "MODX_ASSETS_URLcomponents/phpthumbof/cache/", . I don't know where that "MODX_ASSETS_URL" coming from.
                    It was
                    $modx->getOption('assets_path')
                    was returning
                    "MODX_ASSETS_URL". 


                    I defined "phpthumbof.assets_url" in context setting (as "assets/components/phpthumbof/" in my case).

                    I am not sure if this is the right formal way but it is working at least. So the context specific settings are:

                    phpthumb_document_root
                    phpthumbof.assets_url
                    phpthumbof.cache_path
                    base_path [ed. note: dragona last edited this post 15 years ago.]
                      • Posts
                      This looks great, but what I'm trying to do is cache resized thumbnails pulled from YouTube.

                      According to http://phpthumb.sourceforge.net/demo/docs/phpthumb.faq.txt I can specify an external url for PHPThumb to work with using "$PHPTHUMB_CONFIG['nohotlink_enabled'] = false;" and "$PHPTHUMB_CONFIG['nohotlink_valid_domains']".

                      Is a similar option available in this snippet?