Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
WP.Media: ¿Es posible establecer un límite para la cantidad de fotos/imágenes que se pueden cargar a través de WP.Media?

Estoy creando un editor de modelos 3D, en el que hay una textura llamada CubeTexture, necesita 6 fotos para que funcione. Así que estoy buscando una forma de limitar WP.Media a un mínimo y un máximo de 6 archivos. No estoy buscando una forma de limitar el tamaño de carga, sino específicamente la cantidad de archivos.

Creo que falta la documentación de todos los parámetros, ya que no pude encontrar ningún resumen de todos los parámetros posibles (solo un puñado de preguntas en StackOverflow usando diferentes parámetros en cada uno).

Lo que tengo hasta ahora para resolver este problema es:

 let frame = wp.media({ title: "Selecione ou carregue uma mídia", button: { text: "Usar esta mídia" }, multiple: true // set to "true" }); frame.on("select", () => { let attachments = frame.state().get("selection").toJSON(); attachments = attachments.slice(0, 6); // get the first 6 this.update(canvas, attachments); callback(attachments); }); frame.open();

Pero eso permitiría al usuario elegir menos de seis, por lo que podríamos agregar:

 if (attachments.length < 7) { // restart wp.media somehow }

Pero no sé cómo reiniciar wp.media ni si podría resolver esto agregando algunos parámetros, o incluso si podría resolver esto con PHP.

¡Gracias por adelantado!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!