Skip Navigation

[Résolu] Resize images for slides

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 11 réponses, has 3 voix.

Last updated by Adriano Il y a 8 années et 2 mois.

Assigned support staff: Adriano.

Auteur
Publications
#110214

I am trying to get a standrad size for images uploaded to the slides. I need all images to resize to a pre-defined size. Here is my code:

In function.php

// Add custom image sizes
if ( function_exists( 'add_image_size' ) ) { 
   add_image_size( 'cat-slide', 470, 279, true ); //470 pixels wide and 279 pixels wide
   add_image_size( 'gallery-thumb', 150, 150, true ); //(cropped)
}

In my view:

[types field="featured-image-directory" size="cat-slide"][/types]

Theoretically, this should work, but it's not. I am still seeing images of a variety of sizes even though I actually re-uploaded the images. Also, no option in the Media box add image is created (though not sure it should be).

Any ideas where I might be going wrong?

#110358

Dear triggeru571,

Try to replace your code with:

// Add custom image sizes
if ( function_exists( 'add_image_size' ) ) { 
   add_image_size( 'wpcf-cat-slide', 470, 279, true ); //470 pixels wide and 279 pixels wide
   add_image_size( 'wpcf-gallery-thumb', 150, 150, true ); //(cropped)
}

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

#110624

Hi Adriano,

Not really, same result. Image is displaying in it's natural size. Here is the HTML it is creating inside the slide:

<div id="wpv-view-layout-1" class="wpv-pagination wpv-pagination wpv-pagination-preload-images wpv-pagination-preload-pages" style="visibility: visible; width: 470px; float: none; position: static;" data-duration="500"> <img width="400" height="346" src="<em><u>hidden link</u></em>" class="attachment-cat-slide" alt="" style="" title=""><br> &nbsp;<strong><a href="<em><u>hidden link</u></em>">2Gether Restaurant and Guest House</a></strong></div>
#110787

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hi triggeru571,

Please try re-upload your images again, wordpress will create the pre-defined size when you upload it.

This means that WordPress will create a copy of the Featured Image (formerly known as post thumbnail) with the specified dimensions when you upload a new image.
add_image_size()
http://codex.wordpress.org/Function_Reference/add_image_size

#110895

Did that several times but it does not seem to resize to the size specified in the custom sizes I added to functions.php. Also please note these are not the default featured image I am working with. These are simply images uploaded through a new custom field which I named "featured directory image" - though I doubt this should be an issue.

#111507

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I can not duplicate same problem in my localhost, could you duplicate same problem in a fresh wordpress installation and send login details to my email: luo.y@onthegosystems.com

Also include in this thread URL for reference. thanks

#116908

Sent login details quite some time ago Luoy. Any news?

#117543

Could you provide the access too (adriano.f@onthegosystems.com)?

#117681

Sent again Adriano. Thanks

#118304

Where can I check these images? Please attach an image for reference.

#119863

I have no idea how I missed it but all I needed to do was add an overflow:none to the styles. Thanks for pointing it out in your email Adriano

#120265

You are welcome.