Mass conversion of images - Wordpress

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • femdomdestiny
    Confirmed User
    • Apr 2007
    • 5185

    #1

    Tech Mass conversion of images - Wordpress

    Hi. Did anyone already have a need to convert all existing photos on the website from jpg to WEBP or AVIF format?

    The site is on WP and there are a few thousand blogs posts which means a lot of images. I know there are plugins like Webp converter for media, but what worries me is that it will do redirects instead of really replacing images in posts.

    On top of that, there are many nextgen galleries too.

    thanks
    Femdom Destiny


    --------------------------------------------
    ICQ: 463-630-426
    email: webmaster(at)femdomdestiny.com
  • AmeliaG
    Too lazy to set a custom title
    • Jan 2003
    • 10664

    #2
    What is the need for conversion?

    Once you have the new image files, a search and replace string should prevent redirects, but sounds like a hassle.

    https://wordpress.org/plugins/better-search-replace/


    Plus a lot of stuff doesn’t play well with those formats.
    GFY Hall of Famer

    AltStar Hall of Famer




    Blue Blood's SpookyCash.com

    Babe photography portfolio

    Comment

    • zijlstravideo
      Confirmed User
      • Sep 2013
      • 806

      #3
      Originally posted by AmeliaG
      Plus a lot of stuff doesn’t play well with those formats.
      True, webp isn't fully supported on all devices yet... So you should use the <picture> tag and let the browser decide which format to display.

      <picture>
      <source srcset="boobies.webp" type="image/webp">
      <source srcset="boobies.jpg" type="image/jpeg">
      <img src='boobies.jpg'>
      </picture>


      An option would be to use the free Windows tool Xnconvert, download all your site's jpg files to your pc, convert them all with Xnconvert, then reupload those webp files.

      PHP can convert jpg images in 3 or 4 lines of code, using ImageCreateFromString and store the webp file with imagewebp. Just include it in the upload form so it's automated. You can probably hire someone of Fiverr to do that for you for a few bucks, as it probably takes 10 minutes or so to get it fixed.
      Contact: email

      Comment

      • Theblowjobplace
        Confirmed User
        • Jan 2022
        • 111

        #4
        I use "WebP Converter for Media" and it works perfectly. It also detects browsers that do not support Webp or AVIF images and shows them JPEG or PNG images. Try it.

        Comment

        • femdomdestiny
          Confirmed User
          • Apr 2007
          • 5185

          #5
          Originally posted by AmeliaG
          What is the need for conversion?

          Plus a lot of stuff doesn’t play well with those formats.
          Need is a speed optimization for SEO purposes. Reducing image size is one of the steps.

          Originally posted by zijlstravideo
          True, webp isn't fully supported on all devices yet... So you should use the <picture> tag and let the browser decide which format to display.
          I think it will eventually become mandatory. Actually,I think I am late at least for this site I am improving now. Problem is how to automatically replace paths to new files without spending months
          Femdom Destiny


          --------------------------------------------
          ICQ: 463-630-426
          email: webmaster(at)femdomdestiny.com

          Comment

          • zijlstravideo
            Confirmed User
            • Sep 2013
            • 806

            #6
            Originally posted by femdomdestiny
            Problem is how to automatically replace paths to new files without spending months
            I see...

            I don't use WP so I wouldn't know for sure, but my guess is that Wordpress uses its own custom php function for showing images inside a blog post.

            Meaning, you would only need to change a line or two in the source code to apply that change (to also include webp images) in all blog posts, instead of manually changing thousand blog posts.

            But again, I'm not a Wordpress expert, but I guess such thing would be the case.

            Does Wordpress store posts inside the database using some sort of markdown? If that's the case, it's 100% certain there's some function inside the source code that takes care of the markdown parsing of the images.
            Contact: email

            Comment

            • just a punk
              So fuckin' bored
              • Jun 2003
              • 32385

              #7
              Originally posted by femdomdestiny
              Hi. Did anyone already have a need to convert all existing photos on the website from jpg to WEBP or AVIF format?

              The site is on WP and there are a few thousand blogs posts which means a lot of images. I know there are plugins like Webp converter for media, but what worries me is that it will do redirects instead of really replacing images in posts.

              On top of that, there are many nextgen galleries too.

              thanks
              If you have a CyberSEO Pro license (since you are a GFY member, I assume you have it ) then you already have all the tools you need. Here we go:

              1) If you want to automatically convert images in new posts, just put the following code into the Expert -> Custom PHP code box in your feed settings:


              Code:
              if (!cseo_post_exists($post)) {
                  preg_match_all('/<img.+?src=["\'](.+?)["\'].*?>/is', $post['post_content'] . $post['post_excerpt'], $matches);
                  if (isset($matches[1])) {
                      foreach ($matches[1] as $link) {
                          cseo_store_image($link, $post['post_title'], -1, -1, -1, IMAGETYPE_WEBP);
                      }
                  }
              } else {
                  $post = false;
              }
              Now the plugin will automatically convert post images into the WEBP format.

              2) If you want to do the same trick with images in already existing posts, click Post Modification Tools, put the following code into the box and execute it:

              Code:
              preg_match_all('/<img.+?src=["\'](.+?)["\'].*?>/is', $post->post_content . $post->post_excerpt, $matches);
              if (isset($matches[1])) {
                  foreach ($matches[1] as $link) {
                      $new_link = cseo_save_image($link, $post->post_title, -1, -1, -1, IMAGETYPE_WEBP);
                      if ($new_link != $link) {
                          $post->post_content = str_replace($link, $new_link, $post->post_content);
                          $post->post_excerpt = str_replace($link, $new_link, $post->post_excerpt);
                          cseo_delete_media_by_url(array($link));
                      }
                  }
              }
              Vualá! All your WordPress post images now converted into WEBM

              If you want to convert your images into a different format, simply replace IMAGETYPE_WEBP with the appropriate value, e.g.: IMAGETYPE_JPEG, IMAGETYPE_PNG etc. Find more examples for Modification Tools here: https://www.cyberseo.net/modification-tools/#examples

              P.S. Make sure you are using the most recent version of CyberSEO Pro, which is 9.016 ATM.
              Obey the Cowgod

              Comment

              • kuprum
                Affiliate-Programs.Biz
                • Oct 2016
                • 5

                #8
                https://image.online-convert.com/convert/gif-to-webp

                supports mass conversion, also from Dropbox and Google Drive

                Comment

                • femdomdestiny
                  Confirmed User
                  • Apr 2007
                  • 5185

                  #9
                  Originally posted by CyberSEO
                  If you have a CyberSEO Pro license (since you are a GFY member, I assume you have it ) then you already have all the tools you need. Here we go:

                  1) If you want to automatically convert images in new posts, just put the following code into the Expert -> Custom PHP code box in your feed settings:


                  Code:
                  if (!cseo_post_exists($post)) {
                      preg_match_all('/<img.+?src=["\'](.+?)["\'].*?>/is', $post['post_content'] . $post['post_excerpt'], $matches);
                      if (isset($matches[1])) {
                          foreach ($matches[1] as $link) {
                              cseo_store_image($link, $post['post_title'], -1, -1, -1, IMAGETYPE_WEBP);
                          }
                      }
                  } else {
                      $post = false;
                  }
                  Now the plugin will automatically convert post images into the WEBP format.

                  2) If you want to do the same trick with images in already existing posts, click Post Modification Tools, put the following code into the box and execute it:

                  Code:
                  preg_match_all('/<img.+?src=["\'](.+?)["\'].*?>/is', $post->post_content . $post->post_excerpt, $matches);
                  if (isset($matches[1])) {
                      foreach ($matches[1] as $link) {
                          $new_link = cseo_save_image($link, $post->post_title, -1, -1, -1, IMAGETYPE_WEBP);
                          if ($new_link != $link) {
                              $post->post_content = str_replace($link, $new_link, $post->post_content);
                              $post->post_excerpt = str_replace($link, $new_link, $post->post_excerpt);
                              cseo_delete_media_by_url(array($link));
                          }
                      }
                  }
                  Vualá! All your WordPress post images now converted into WEBM

                  If you want to convert your images into a different format, simply replace IMAGETYPE_WEBP with the appropriate value, e.g.: IMAGETYPE_JPEG, IMAGETYPE_PNG etc. Find more examples for Modification Tools here: https://www.cyberseo.net/modification-tools/#examples

                  P.S. Make sure you are using the most recent version of CyberSEO Pro, which is 9.016 ATM.
                  Damn., I've purchased the plugin in 2012! and never tried it. Will take a look later, hosting is working on doing all this for me.thanks
                  Femdom Destiny


                  --------------------------------------------
                  ICQ: 463-630-426
                  email: webmaster(at)femdomdestiny.com

                  Comment

                  • just a punk
                    So fuckin' bored
                    • Jun 2003
                    • 32385

                    #10
                    Originally posted by femdomdestiny
                    Damn., I've purchased the plugin in 2012! and never tried it. Will take a look later, hosting is working on doing all this for me.thanks
                    Unfortunately the version of 2012 is too old to do these things. You will need to prolong your license to receive the plugin updates during a year.

                    You can do it here for 50% of the base price: https://www.cyberseo.net/upgrade/
                    Obey the Cowgod

                    Comment

                    • blackmonsters
                      Making PHP work
                      • Nov 2002
                      • 20993

                      #11
                      The internet 1998 : Wow, I'm free!!

                      The internet today : I'm a slave of Google artificial intelligence.

                      Your neighbor will murder you with frogs
                      Click here

                      Comment

                      • femdomdestiny
                        Confirmed User
                        • Apr 2007
                        • 5185

                        #12
                        Thanks to all people answering above.
                        Hosting support did the whole job for me.
                        Femdom Destiny


                        --------------------------------------------
                        ICQ: 463-630-426
                        email: webmaster(at)femdomdestiny.com

                        Comment

                        • AmeliaG
                          Too lazy to set a custom title
                          • Jan 2003
                          • 10664

                          #13
                          Originally posted by blackmonsters
                          The internet 1998 : Wow, I'm free!!

                          The internet today : I'm a slave of Google artificial intelligence.

                          So sadly true
                          GFY Hall of Famer

                          AltStar Hall of Famer




                          Blue Blood's SpookyCash.com

                          Babe photography portfolio

                          Comment

                          • femdomdestiny
                            Confirmed User
                            • Apr 2007
                            • 5185

                            #14
                            Hm..I've noticed a drop in traffic after replacing jpegs with WEBP. At the moment I am not sure is it the result of changing WordPress theme or traffic loss coming from google images searches.

                            So I am now trying to see the number of searches coming from google images. I am using analytics and trying with source/medium section but there are no results.

                            Any Idea how to filter and see only google images traffic?
                            Femdom Destiny


                            --------------------------------------------
                            ICQ: 463-630-426
                            email: webmaster(at)femdomdestiny.com

                            Comment

                            • zijlstravideo
                              Confirmed User
                              • Sep 2013
                              • 806

                              #15
                              Originally posted by femdomdestiny
                              Hm..I've noticed a drop in traffic after replacing jpegs with WEBP. At the moment I am not sure is it the result of changing WordPress theme or traffic loss coming from google images searches.

                              So I am now trying to see the number of searches coming from google images. I am using analytics and trying with source/medium section but there are no results.

                              Any Idea how to filter and see only google images traffic?
                              Not sure exactly... But you can do a quick search on Google images yourself to see if they are still indexed. Use the query: site:yourdomain.com

                              But if they are no longer indexed, did you literally replaced the jpg's for webp files only, rather then setting multiple formats with the <picture> tag? Otherwise, I don't see what could cause the de-indexing to happen.
                              Contact: email

                              Comment

                              Working...