Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip resized images #37

Open
darksam1995 opened this issue Sep 15, 2018 · 1 comment
Open

Skip resized images #37

darksam1995 opened this issue Sep 15, 2018 · 1 comment

Comments

@darksam1995
Copy link

First of all, Thank you for this awesome plugin.

Can you please tell me how can I skip file migration of resized images.
I want to download only the main images not (image-100X100.jpg)

Please let me know how can i do it, i can edit files easily and know php also.

Thank you. :)

@darksam1995
Copy link
Author

darksam1995 commented Sep 15, 2018

Open File::: wp-content/plugins/wp-sync-db-media-files-master/wpsdb-media-files.php

function add_files_to_migrate( $attachment, $remote_media ) {
	if( isset( $remote_media[$attachment['file']] ) ) {
		$this->files_to_migrate[$attachment['file']] = $remote_media[$attachment['file']];
	}
	//if( empty( $attachment['sizes'] ) || apply_filters( 'wpsdb_exclude_resized_media', false ) ) return; //change false to true
	if( empty( $attachment['sizes'] ) || apply_filters( 'wpsdb_exclude_resized_media', true ) ) return; //change false to true
	foreach( $attachment['sizes'] as $size ) {
		if( isset( $remote_media[$size] ) ) {
			$this->files_to_migrate[$size] = $remote_media[$size];
		}
	}
}

function maybe_add_resized_images( $attachment, $site_b_media, $site_a_media ) {
	//if( empty( $attachment['sizes'] ) || apply_filters( 'wpsdb_exclude_resized_media', false ) ) return; //change false to true
	if( empty( $attachment['sizes'] ) || apply_filters( 'wpsdb_exclude_resized_media', true ) ) return; //change false to true
	foreach( $attachment['sizes'] as $size ) {
		if( isset( $site_b_media[$size] ) && ! isset( $site_a_media[$size] ) ) {
			$this->files_to_migrate[$size] = $site_b_media[$size];
		}
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant