images – Using srcsets in a custom block

I’m building a few custom blocks and have come across something I am not sure is either possible at the current time (as there does not seem to be docs on it), or it is something people are still figuring out.

I’m wondering is it possible to access the image srcsets in a custom blocks. This is my current markup which is accessing the sizes array to get my chosen image size. Which is ok, but obviously not ideal when you get down to a mobile size.


attributes: {
            mediaID: {
                type: "number",
            },
            mediaURL: {
                type: "string",
                source: "attribute",
                selector: "img.promogroupitem__media--img",
                attribute: "src",
            },
            mediaAlt: {
                type: 'string',
                source: 'attribute',
                selector: 'img.promogroupitem__media--img',
                attribute: 'alt'
            },
            mediaWidth: {
                type: 'number',
                source: 'attribute',
                selector: 'img.promogroupitem__media--img',
                attribute: 'width',
            },
            mediaHeight: {
                type: 'number',
                source: 'attribute',
                selector: 'img.promogroupitem__media--img',
                attribute: 'height',
            },  
        },
        parent: 'wpboiler-core/promo-group',

        edit: function(props) {
            const { attributes, setAttributes } = props;
            const { 
                mediaID,
                mediaURL,
                mediaAlt,
                mediaWidth,
                mediaHeight, 
            } = attributes;

            const onSelectImage = media => setAttributes({ 
                mediaID: media.id, 
                mediaURL: (media.sizes.promo ? media.sizes.promo.url : media.url),
                mediaAlt: media.alt,
                mediaWidth: (media.sizes.promo ? media.sizes.promo.width : media.width),
                mediaHeight: (media.sizes.promo ? media.sizes.promo.height : media.height),
            });

            return el(
                'article',
                useBlockProps(attributes),

                el(
                    InspectorControls, 
                    null,

                    // IMAGE UPLOAD BEGIN
                    el(
                        PanelBody,
                        {
                          title: "Background Image",
                        },
            
                        el(MediaUpload, {
                          onSelect: onSelectImage,
                          allowedTypes: "image",
                          value: mediaID,
                          render: (obj) => {
                            return el(
                              Button,
                              {
                                className: "components-button is-primary",
                                onClick: obj.open,
                              },
                              !mediaID
                                ? __("Upload Image", "card-group")
                                : __("Replace Image", "card-group")
                            );
                          },
                        }),
            
                        mediaID
                          ? el(
                              Button,
                              {
                                className: "components-button is-tertiary",
                                style: { marginLeft: "5px" },
                                onClick: () => setAttributes({ 
                                    mediaID: "", 
                                    mediaURL: "",
                                    mediaAlt: "",
                                    mediaHeight: "",
                                    mediaWidth: "",
                                }),
                              },
                              "Remove Image"
                            )
                          : ""
                      )
                      // IMAGE UPLOAD END

                ),
                
                el(
                    'div',
                    { className: 'promogroupitem__container' },

                    mediaURL ? 
                    el(
                        'div',
                        { className: 'promogroupitem__media' },

                        el(
                            'img',
                            { 
                                className: 'promogroupitem__media--img',
                                src: mediaURL,
                                loading: 'lazy',
                                width: mediaWidth,
                                height: mediaHeight,
                                alt: mediaAlt,
                            }
                        ),
                    ) : '',
                )
            );
        },

save: function(props) {
            const { attributes } = props;
            const { 
                mediaURL, 
                mediaAlt,
                mediaHeight,
                mediaWidth, 
            } = attributes;

            return el(
                'article',
                { className: 'promogroupitem' },

                el(
                    'div',
                    { className: 'promogroupitem__container' },

                    mediaURL ?
                    el(
                        'div',
                        { className: 'promogroupitem__media' },

                        el(
                            'img', { 
                                className: 'promogroupitem__media--img',
                                src: mediaURL,
                                loading: 'lazy',
                                width: mediaWidth,
                                height: mediaHeight,
                                alt: mediaAlt,
                            }
                        ),
                    ) : '',

                ),
            );
        },

Its something I am not quite sure how to resolve. Has anyone come across this and developed/found a solution for it?

Configurable product duplicates smaller images (below the main image)

I’ve seen all the videos on how to configure a configurable product. And I can’t find the error.enter image description here

See the image please.

REMOVE BACKGROUND IMAGE FROM THE PHOTO for $15

Hi, I am Kamran Khan. I can remove background image from photo and I have do your project with your expectations. I can also do photography type project. I am wait for you. See you!

by: Khankaman16
Created: —
Category: Graphics & Logos
Viewed: 201


.

dnd 5e – Can you use past edition D&D images in your original content released on DMsGuild?


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




Interactive Images

Hey all,

I was wondering how this website made the images interactive (grow and shrink side-by-side)? Link is:
https://www.bauhauskooperation.com/kooperation/project-archive/magazine/follow-the-bauhaus-into-the-world/jeanneret-made-in-india/

Thanks!

avd manager – Which format the system images for avd are in

After downloading an image for android virtual device via avdmanager there are system.img userdata.img ramdisk.img and kernel_ranchu in system images folder. Which format are they in and how to read/mount them outside avd?

My investigation so far:

As many people here and over the internet suggests they are sparse images. But they are nit. Simg2img hence doesn’t work.
System.img is not a raw ext4 image either.

file ststem.imgreturns dos/mbr boot sector. With fdisk -l there are 2 partitions in the gpt partitioned image, labeled as linux partition.But setting up losetup none can be mounted. Even file -s doesn’t recognize partitions. Interestingly first partition os from offset 2048 to 4096. Second is the rest.
These images are definitely not encrypted as strings returns readable data like app names script contents.

So I’m wondering what kind of filesystem that can be.

Ps: the sw apply for both google play and aosp devices.

blueprints – Unreal How to Feed Images into Open CV Lens Distortion Calibrator

I’m currently trying to use the OpenCv Lens Distortion plugin that comes installed by default with the Virtual Production example in Unreal 4.27 to try and create a camera undistortion texture for my camera. So far I have had no issue getting this to work with by manually setting the lens distortion parameters (K(1-6), P1, P2, etc.) but now I want to automatically generate this data using a series of images from my camera. To do this I threw together a blueprint (couldn’t get access to OpenCV from C++ scripts) that takes a directory, grabs all jpg files and feeds them into the calibrator.

enter image description here

Unfortunately no matter what I try the calibrator refuses to accept any of my test images, and since this is a blueprint I can’t really debug the problem any more, all I know is that the FeedImage node returns false for every image. I’ve tried searching for documentation or tutorials using OpenCV Lens Distortion but for some reason it is a completely undocumented feature besides a couple pages saying the nodes exist and 2 or 3 questions on this answer hub asking how to turn the distortion variables into a texture. If anyone knows what I might be missing please let me know.

enter image description here

Just for reference, here is a sample of one of my test images:

  • Board Width: 10
  • Board Height: 7
  • Square Size: 3.2727 cm

I was able to get OpenCV working directly in another program using a python script but I would like to have this working in Unreal to minimize the amount of programs needed. Obviously the functions are difference since Python deals directly with OpenCv while Unreal is using a blueprint wrapper but at least I know the images and calibrator settings should be valid.

I also want to mention I saw the Lens Distortion plugin mentioned in this post, but unfortunately it does not seem to have the ability to accept images to generate a lens distortion model, it simply builds one using the k1, k2, k3, p1, p2 parameters and camera matrix values.

amazon s3 – What is the most intelligent way to store tiny SVG images in S3 Bucket for a single web page consumption?

All image assets need to be loaded for home page (not the case where each image is for a different page).

If I understand correctly, if each image gets stored in a different bucket Object, then we are opening a new HTTP connection for each download.

Will it be faster if I store all SVGs within the same object?

Is it worth considering gzip compression? (or any other kind of compression?)

$ – PS5Forum/PS5Daily Mobile App Images | Forum Promotion

I’ve had a successful CODForums thread, but I’m back with another one, though for a different reason here. I already have logos for both sites. This is for the PWA Mobile App (for those of you unaware, xenforo released an update that allowed for PWA Mobile App.)

+ Mobile Icon must be 192×192
+ 2nd Mobile Icon must be 512×512
+ All images must be transparent (hence PNG is recommended.)
+ The font is “Nightjar Text Demi.”

PS5Forum’s current Metadata image is…

PS5FSocial.png

PS5Daily’s current Metadata image is…

PS5DailySocial.png

The old metadata was this, but I can’t find the name of the font. I loved the font.

PS4FSocial.png

F.Y.I. Both images are in 200×200, PNG, and transparent. Any takers?

 

concurrency – A ktor/Kotlin server which generates Discord profile banner images

I wrote my first project with ktor, it generate a nicely layout image with your Discord account information and current activity on Discord – in real time.

I mainly write Python code and rarely any Kotlin so I was wondering if I am using the coroutines correctly. Any other criticism related to the code is also welcome.

The code is on my GitHub repo here: https://github.com/quanta-kt/DiscordProfileBanner

And here are some relevant bits which I suspect to be “improperly done”-

  1. Have I wrapped the generateImage() to make correct use of co-routines?
suspend fun generateImage(
   username: String,
   tag: Int,
   avatarUrl: String,
   status: OnlineStatus,
   activity: String?,
): BufferedImage = withContext(Dispatchers.Default) {  // Using Dispatches.Default because image generation is seemingly a CPU intensive task

   // Download the user's avatar
   val avatar = async(Dispatchers.IO) {  // Using Dispatchers.IO for downloading
       val connection = URL(avatarUrl).openConnection() as HttpURLConnection
       connection.requestMethod = "GET"
       connection.connect()

       val responseStatus = connection.responseCode
       if (responseStatus in 199..300) {
           return@async ImageIO.read(connection.inputStream)
       } else {
           logger.error("Error while reading avatar.n" +
                   "Response: ${connection.inputStream.readNBytes(2147483647)}")
           throw HttpException(connection.responseMessage)
       }
   }

   // ...
   // Image generation code here

   image
}
  1. Starting a Discord bot using JDA takes quite a time, is there any other way?
val bot = JDABuilder.createLight(
   token,
   GatewayIntent.GUILD_PRESENCES,
   GatewayIntent.GUILD_MEMBERS
)
   .injectKTX()
   .enableCache(CacheFlag.ONLINE_STATUS)
   .enableCache(CacheFlag.ACTIVITY)
   .build()
   .awaitReady()