regenarate thumbnails eklentisi ile wp cli ile kucuk resimler olusturmak

Regenerate Thumbnails eklentisi ile WP-CLI ile küçük resimler oluşturmak

Büyük sitelerde binlerce resminizin olduğunu düşünürseniz bunun sadece ssh üzerinden gerçekleştirebileceğiniz bir işlem olduğunu kabul etmeniz gerekir. Ve bu da WP-CLI ile mümkündür..

Serverınıza kuruluysa hemen işlem siteniz altına ana dizine gitmeniz gerekir

Değilse SSH erişimiz varsa :

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

php wp-cli.phar –info

chmod +x wp-cli.phar

sudo mv wp-cli.phar /usr/local/bin/wp

wp –info

wp plugin list

 

regenarate thumbnails eklentisi ile wp cli ile kucuk resimler olusturmak

cd /var/www/vhosts/site adınızı yazın uzantısı ile /httpdocs

cd /var/www/vhosts/eysar.net/httpdocs

burada ilgili komutları çalıştıracağız…

 

wp media regenerate

[<attachment-id>…]
One or more IDs of the attachments to regenerate.
[–image_size=<image_size>]
Name of the image size to regenerate. Only thumbnails of this image size will be regenerated, thumbnails of other image sizes will not.
[–skip-delete]
Skip deletion of the original thumbnails. If your thumbnails are linked from sources outside your control, it’s likely best to leave them around. Defaults to false.
[–only-missing]
Only generate thumbnails for images missing image sizes.
[–yes]
Answer yes to the confirmation message. Confirmation only shows when no IDs passed as arguments.

Examples

# Regenerate thumbnails for given attachment IDs.
$ wp media regenerate 123 124 125
Found 3 images to regenerate.
1/3 Regenerated thumbnails for "Vertical Image" (ID 123).
2/3 Regenerated thumbnails for "Horizontal Image" (ID 124).
3/3 Regenerated thumbnails for "Beautiful Picture" (ID 125).
Success: Regenerated 3 of 3 images.

# Regenerate all thumbnails, without confirmation.
$ wp media regenerate --yes
Found 3 images to regenerate.
1/3 Regenerated thumbnails for "Sydney Harbor Bridge" (ID 760).
2/3 Regenerated thumbnails for "Boardwalk" (ID 757).
3/3 Regenerated thumbnails for "Sunburst Over River" (ID 756).
Success: Regenerated 3 of 3 images.

# Re-generate all thumbnails that have IDs between 1000 and 2000.
$ seq 1000 2000 | xargs wp media regenerate
Found 4 images to regenerate.
1/4 Regenerated thumbnails for "Vertical Featured Image" (ID 1027).
2/4 Regenerated thumbnails for "Horizontal Featured Image" (ID 1022).
3/4 Regenerated thumbnails for "Unicorn Wallpaper" (ID 1045).
4/4 Regenerated thumbnails for "I Am Worth Loving Wallpaper" (ID 1023).
Success: Regenerated 4 of 4 images.

# Re-generate only the thumbnails of "large" image size for all images.
$ wp media regenerate --image_size=large
Do you really want to regenerate the "large" image size for all images? [y/n] y
Found 3 images to regenerate.
1/3 Regenerated "large" thumbnail for "Sydney Harbor Bridge" (ID 760).
2/3 No "large" thumbnail regeneration needed for "Boardwalk" (ID 757).
3/3 Regenerated "large" thumbnail for "Sunburst Over River" (ID 756).
Success: Regenerated 3 of 3 images.

Global Parameters

These global parameters have the same behavior across all commands and affect how WP-CLI interacts with WordPress.

Argument Description
--path=<path> Path to the WordPress files.
--url=<url> Pretend request came from given URL. In multisite, this argument is how the target site is specified.
--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>] Perform operation against a remote server over SSH (or a container using scheme of “docker”, “docker-compose”, “docker-compose-run”, “vagrant”).
--http=<http> Perform operation against a remote WordPress installation over HTTP.
--user=<id\|login\|email> Set the WordPress user.
--skip-plugins[=<plugins>] Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded.
--skip-themes[=<themes>] Skip loading all themes, or a comma-separated list of themes.
--skip-packages Skip loading all installed packages.
--require=<path> Load PHP file before running the command (may be used more than once).
--exec=<php-code> Execute PHP code before running the command (may be used more than once).
--context=<context> Load WordPress in a given context.
--[no-]color Whether to colorize the output.
--debug[=<group>] Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help.
--prompt[=<assoc>] Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values.
--quiet Suppress informational messages.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.


 

yukarıdaki sayfaya örnek kod için bakarsak wp media regenerate –yes  dediğimizde tüm resimlerimizin küçük resimlerini oluşturacaktır.  Ben bunun yanında sadece kayıp olanalrı eklemesini isteyeceğim o da yukarıda görüldüğü gibi

–only-missing kodunu ekliyorum

wp media regenerate --yes --only-missing

 

kodunuz çalışmadıysa şu hata çıkacaktır:

root@srv ~ # cd /var/www/vhosts/eysar.net/httpdocs
root@srv /var/www/vhosts/eysar.net/httpdocs # wp media regenerate --yes --only-missing
Error: YIKES! It looks like you're running this as root. You probably meant to r un this as the user that your WordPress installation exists under.

If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making i t quite DANGEROUS.

If you'd like to continue as root, please run this again, adding this flag: --a llow-root

If you'd like to run it as the user that this site is under, you can run the fol lowing to become the respective user:

sudo -u USER -i -- wp <command>

Bizim buna göre komutumuzun sonuna sadece –allow-root eklememiz yeterli olacaktır.bütün WP CLI komutlarının sonua eklenmesi gerekiyor komutunuzun çalışması için.

wp media regenerate --yes --only-missing --allow-root

İlginizi Çekebilir

thumbnail?id=1zEHDTlmS2V l BMkJBaL6l5LB5TKNqFX&sz=w310 h165

WP-CLI ile EWWW Image Optimizer kullanımı

WP-CLI ile optimizasyon   EWWW Image Optimizer, görsellerinizi “toplu olarak” optimize etmenize olanak tanıyan bir …

jetpack buinlardan da haberdar olun kismi kismi cikmiyorsa

Jetpack bunlardan da haberdar olun kısmı çıkmıyorsa

Jetpack bunlardan da haberdar olun kısmı çıkmıyorsa Jetpack -ayarlar yazma kısmında bulunan şu alanı aktif …

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir