imagecache_profiles и вывод фотки для гостей[РЕШЕНО]

Главные вкладки

Аватар пользователя Paldru Paldru 28 июля 2009 в 0:09

Юзаю imagecache_profiles для изменения размера загружаемых фоток в профиль.
На странице профиля user-profile.tpl.php вывожу фотку через
<?php  if($user->picture) {print theme('user_picture'$user);}?>
Но для незалогиненых юзеров фотка не отображается, в "разрешениях" стоит галочка возле view imagecache profile_photo_200x250 и view imagecache profile_photo_100x120. В чем может быть дело?

Комментарии

Аватар пользователя kosilko kosilko 28 июля 2009 в 9:42

"Paldru" wrote:
Юзаю imagecache_profiles для изменения размера загружаемых фоток в профиль.
На странице профиля user-profile.tpl.php вывожу фотку через
<?php if($user->picture) {print theme('user_picture', $user);}?>

у вас уже есть imagecache и вы правите шаблон, так зачем вам еще доп. модуль-навесок когда можно обойтись тем что предлагает imagecache? Цитата из ридми:
Quote:

ImageCache also defines a theme function that you can use in your modules and
themes to automatically display a manipulated image. For example, to use the
theme function in a .tpl.php file, add the following line where you would like
the image to appear:

<?php
print theme('imagecache', 'preset_namespace', $image_filepath, $alt, $title, $attributes);
?>

Аватар пользователя Paldru Paldru 28 июля 2009 в 16:23
prover'te stoyat li dlya gostej prava na:
иметь доступ к профилям пользователей

Да стоят, иначе по идее аноним вообще бы профиль не видел.

<br /> у вас уже есть imagecache и вы правите шаблон, так зачем вам еще доп. модуль-навесок когда можно обойтись тем что предлагает imagecache? Цитата из ридми:<br /> [quote wrote:

ImageCache also defines a theme function that you can use in your modules and
themes to automatically display a manipulated image. For example, to use the
theme function in a .tpl.php file, add the following line where you would like
the image to appear:

<?php
print theme('imagecache', 'preset_namespace', $image_filepath, $alt, $title, $attributes);
?>


Ну это как я понял код для вывода любого изображения из имаджекэша. Но как тогда я выведу "nophoto" картинку, если юзер например не загрузил фотку?

Аватар пользователя Paldru Paldru 28 июля 2009 в 16:35

Итак, немного покурив гугл ошибку нашел.
Вместо
<code lang="php"><?php  if($user->picture) {print theme('user_picture', $user);}?>
Пишем

<code lang="php"><?php
if ($account->picture) { print theme('user_picture', $account); }

else { print '<img src="/nophoto.jpg"/>';}
?>


Т.е в данном случае нужно было заменить $user на $account? иначе выводится фотка залогиненого юзера, а не аккаунта