I have a folder in my sites/default/files directory filled with product jpg's gathered from an external server and back end stock take system.
The files look like this...
I am using theme_image_style in a custom block template to print the images using an image style from Drupal 7's core image handler like so...
<?php print theme_image_style( array( 'style_name' => 'category_header', 'path' => 'product_group_images/' . $productcategoryurl . '.jpg', 'attributes' => array( 'class' => 'category-header-image' ), 'width' => NULL, 'height' => NULL, ) ); ?>
$productcategoryurl is the image name inside the product_group_images folder.
This all works great where the image is only one word, like
The trouble I am having is the "+" or "&" (%26) in the image names.
I have tried str_replace to swap the spaces in the product name with "+", but in the path, the "+" is always encoded, and the image is never saved in the new style.
So my path comes out like....
And therefore, no image is created in the /sites/all/files/styles directory.
Is there a way using the "path" in the array to actually use the "+" as a space without encoding it?
I hope ive explained that well enough, its late!