2

How do I pass the logo on my theme to the image module to create different sizes? I'm using domain access to I can't use

<?php print theme('image_style', array('style_name' => 'thumbnail', 'path' =>'public://new_ctrl_logo_front1_1.jpg')); ?>

as I'm using domain access and using one theme for use on multiple sites. I found this code on another form that works on my theme and need to know if I can pass an image style through it.

<?php
if (theme_get_setting('toggle_logo')) {
$image = array(
'path' => theme_get_setting('logo'),
'alt' => 'my logo',
);
print theme('image', $image);}?> 

Thanks for helping, Gregory S.

2

Update

If one needs to obtain "JUST" the filename for theme logo for the active theme for any given domain in a domain access environment (as the OP found he needed to do), then the following code provides the image file name for the theme logo as $img_file.

$global $base_url;
img_path = theme_get_setting('logo'); 
$str_to_remove = $base_url . '/sites/default/files/'; 
$img_file = str_replace($str_to_remove, '', $img_path);

Original

Pass "theme_get_setting('logo')" as the path for the first php script?

<?php print theme('image_style', array('style_name' => 'thumbnail', 'path' => theme_get_setting('logo'))); ?> 

or rather - an amalgamation of the two -

if (theme_get_setting('toggle_logo')) {
print theme('image_style', array('style_name' => 'thumbnail', 'path' => theme_get_setting('logo')));
}
13
  • Neither didn't work. Jun 25 '15 at 18:49
  • Echo theme_get_setting('logo'); and post the output. Jun 25 '15 at 18:49
  • print theme('image_style', array('style_name' => 'thumbnail', 'path' => echo 'theme_get_setting('logo')')); gave me WSOD (white screen of death) Jun 25 '15 at 18:52
  • No. Don't do that. Literally just Echo theme_get_setting('logo') in order to see what it's outputting. Also I see that you've placed 'theme_get_setting('logo') as a string. When you originally tried the code I posted the first time, did you also insert it as a string? Jun 25 '15 at 18:53
  • I can echo and pass it as a string. <?php $logo_image = theme_get_setting('logo'); print $logo_image; ?> Jun 25 '15 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.