Home Forums WC Vendors Pro Support Product image sizes

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 26 posts - 1 through 26 (of 26 total)
  • Author
    Posts
  • #26500
    ryank
    Participant

    I would like to have the vendors who upload be FORCED an image size. If the vendors can upload any image size, the site will not look consistent. My programmer dude said that he could do this for me but would have edit the plugin code, which means I would loose this code if i updated. Is the anyway that you know of to allow only one size when a vendor uploads without messing with the plugin code?

    #26508
    WC Vendors Support
    Participant

    I think you need a new programmer. Image sizes for your products is a WooCommerce setting, or a theme setting. We don’t control product image sizes at all. 🙂

    #26512
    ryank
    Participant

    I guess i did not explain it well enough. I would like vendors to be able to upload only one image size. For example, when they upload images, the images MUST BE 800 x 450. Nothing smaller and nothing larger. ONLY THAT SIZE.

    #26515
    WC Vendors Support
    Participant

    That’s also not WC Vendors. 🙂 That’s the WordPress media library tool. I’d be googling “wordpress force media library to only accept certain image sizes” and see what you can find. Not sure that could be done though.

    #26517
    ryank
    Participant

    Ive been doing that 🙂 ill keep looking.

    #26519
    ryank
    Participant
    #26521
    WC Vendors Support
    Participant

    Nifty — That looks like it could work well. Just run a check to see if the user has the role Vendor before running the restriction code, otherwise you as an admin could have some issues. 🙂

    #26523
    ryank
    Participant

    Its finally coming together after all this time http://www.logochalet.com its almost done.

    #26532
    WC Vendors Support
    Participant

    Happy times. Quite the pretty site! Maybe we’ll be one of your first customers to get a new WC Vendors logo. 😉

    #26533
    ryank
    Participant

    Ha, thanks.. well, I got the minimum dimensions to work to work 🙂 now trying to figure out how to set a maximum the same way so that it would only allow that ONE size.. tricky dicky stuff here!

    #26534
    WC Vendors Support
    Participant

    Copy and paste the code you’re using to gist.github.com or pastebin.com and then link to it here in the forums. I’ll see if something obvious sticks out.

    #26536
    ryank
    Participant

    like this? https://gist.github.com/anonymous/e8ba297ecd4b75099164
    I tried to just duplicate the minimum and change to maximum,, no worky.

    #26538
    WC Vendors Support
    Participant

    Try this:

    Line #21 if ( $img[0] < $minimum['width'] or $img[0] > $minimum['width'] )

    Line #28 elseif ( $img[1] < $minimum['height'] or $img[1] > $minimum['height'] )

    #26539
    WC Vendors Support
    Participant

    Then probably change the line #22-26 and then the other block of that to:

    $file['error'] = 'The correct height for images must be whatever'; and then use that for the width error, too.

    #26540
    ryank
    Participant
    #26541
    ryank
    Participant

    GOT IT!!!! Now I just realized a problem. LOL I cant upload the store banners or icons with this in place.. damn, if it ain’t one thing its another this one seems to work.. just for the record.
    https://gist.github.com/anonymous/073fab9378822fec86f3

    #26542
    ryank
    Participant

    well, it works for the vendor, but it is also preventing admin from uploading any size.. grrrr..

    #26543
    WC Vendors Support
    Participant

    Google a way to check the “REQUEST_URI” and then use that REQUEST_URI to check if /dashboard/product/edit/ is in the URI path, and if it is, then execute the code you’ve written (wrap it all in an if statement).

    #26544
    ryank
    Participant

    hahahahah… do what? hahahah I have no idea how to code anything, I have been winging all of this. I dont even know what an “if statement” is LOL

    #26545
    WC Vendors Support
    Participant

    This is how you learn! Google, read, understand, try, test. 🙂

    #26546
    ryank
    Participant

    yeppers

    #26547
    ryank
    Participant

    holy cow i got admin to be bypassed.. I need a cookie 🙂 Thanks for your help ben. I’ll start the research on figuring out how to have this only for the product uploads page.

    #26548
    ryank
    Participant

    hey Ben.. Ok.. Maybe you can help me just this once… take a look at this https://gist.github.com/anonymous/1cf5ddc6ac1e9abd2d38 I thought that maybe just adding this filter to the one page it would work.. I added “if (!is_page_template(‘product-edit.php’))” too line 2, but that didn’t work. any ideas how to apply this filter to only the product edit page?

    #26552
    WC Vendors Support
    Participant

    ! means “not”. And then your if statement isnt working:

    Change:

    if (!is_page_template('product-edit.php'))
    add_action( 'admin_init', 'block_vendors_from_uploading_images' );

    to:

    if (is_page_template('product-edit.php')) {
    add_action( 'admin_init', 'block_vendors_from_uploading_images' );
    }

    Not sure if that will actually work or not, but the code syntax is now correct. 🙂

    #26553
    ryank
    Participant

    nope.. nice try though.. I’ll figure this out even if it takes me all day LOL

    #58434
    Elsa Soares
    Participant

    Hi,

    Congratulations @ryank and @ben.

    This subject is crucial and very important because images are the first to sell, being important to keep the site looking consistent.

    With the code referenced in https://gist.github.com/anonymous/1cf5ddc6ac1e9abd2d38 we are almost there, that is, the only aspect missing is the vendor being able to load the banner and the store icon with different dimensions.

    Changing to:

    if (is_page_template(‘product-edit.php’)) {
    add_action( ‘admin_init’, ‘block_vendors_from_uploading_images’ );
    }

    …is not working, because like that vendors are able to upload any image size.

    I am very grateful if you can indicate me the missing piece of the puzzle. 🙂

    Thanks

Viewing 26 posts - 1 through 26 (of 26 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.