GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech Mass conversion of images - Wordpress (https://gfy.com/showthread.php?t=1354240)

femdomdestiny 04-17-2022 06:36 PM

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

AmeliaG 04-17-2022 11:25 PM

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.

zijlstravideo 04-18-2022 02:15 AM

Quote:

Originally Posted by AmeliaG (Post 22992784)
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.

Theblowjobplace 04-18-2022 04:05 AM

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.

femdomdestiny 04-18-2022 05:55 AM

Quote:

Originally Posted by AmeliaG (Post 22992784)
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.

Quote:

Originally Posted by zijlstravideo (Post 22992815)
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

zijlstravideo 04-18-2022 07:02 AM

Quote:

Originally Posted by femdomdestiny (Post 22992854)
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.

just a punk 04-18-2022 08:40 AM

Quote:

Originally Posted by femdomdestiny (Post 22992719)
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 :winkwink:) 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 :pimp

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.

kuprum 04-18-2022 09:17 AM

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

supports mass conversion, also from Dropbox and Google Drive

femdomdestiny 04-18-2022 10:10 AM

Quote:

Originally Posted by CyberSEO (Post 22992887)
If you have a CyberSEO Pro license (since you are a GFY member, I assume you have it :winkwink:) 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 :pimp

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

just a punk 04-18-2022 10:55 AM

Quote:

Originally Posted by femdomdestiny (Post 22992933)
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/

blackmonsters 04-18-2022 11:19 AM

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

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

:2 cents:

femdomdestiny 04-19-2022 10:32 AM

Thanks to all people answering above.
Hosting support did the whole job for me.

AmeliaG 04-19-2022 11:42 AM

Quote:

Originally Posted by blackmonsters (Post 22992949)
The internet 1998 : Wow, I'm free!!

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

:2 cents:

So sadly true

femdomdestiny 04-23-2022 12:53 PM

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?

zijlstravideo 04-23-2022 01:18 PM

Quote:

Originally Posted by femdomdestiny (Post 22994380)
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.


All times are GMT -7. The time now is 11:49 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123