solved only add img code if user uploaded img

soaringeagle
@soaringeagle
11 years ago
3,304 posts
i have added a profile_cover_image
i added it to the create a profile and modify profile forms

this code
{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_cover_image" item_id=$_profile_id size="xlarge" class="img_scale" alt=$profile_name title=$hover width=false height=false}
displays the image wherei want how i want but then on profiles that dont have 1 uploaded it puts up a default pic
luckily i changed that to something less hideous
but its not what i want
i want no image code if none was uploaded
i tried this
{if isset($profile_cover_image) && strlen($profile_cover_image) > 0}
{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_cover_image" item_id=$_profile_id size="xlarge" class="img_scale" alt=$profile_name title=$hover width=false height=false}{/if}

then no image appears anywhere
i have tried multiple variations that made sence..or didnt and all either display the image and defaults on empty profiles or nothing at all
i added an
{else}upload a cover photo{/if} 
but then always get that or the default
i cant seem to get that if statement right so it will only put in the image code if a user actualy uploaded a cover photo


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities

updated by @soaringeagle: 12/11/14 09:25:45AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
figured it out
 && $profile_cover_image_type != image/jpeg

== made more sence since the defaults a png but since it gave the oposite effecti wanted != was the only sensible option and it worked


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
SteveX
SteveX
@ultrajam
11 years ago
2,584 posts
That says "if the image is not a jpeg"

So if your users upload .png or gif images they will not appear.

Might be better to check the size or similar? Put {debug} into your template to see what variables are available there.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
douglas
@douglas
11 years ago
2,806 posts
I just tested this on my dev site and you'll want to use this:

{if isset($profile_cover_image_size) && strlen($profile_cover_image_size) > 0}
{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_cover_image" item_id=$_profile_id size="xlarge" class="img_scale" alt=$profile_name title=$hover width=false height=false}{else}
Something else here...
{/if}

Hope this helps! :)


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
soaringeagle
@soaringeagle
11 years ago
3,304 posts
i tried that and that did nit work
that made no images apear
ill try again to besure but when i tried that ..nothing
and i swear that im using a jpg and the default was png so it kinda is confusing that its alowing the jpg blocking the png

let my retry your code and ill get back to u in a few min


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ah i see what u did diferent from what the other guy gave me in the ning-jamroom forum yours makes sence and works perfectly thank you


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
douglas
@douglas
11 years ago
2,806 posts
I gave you the other code too, the problem was the variable profile_cover_image never gets anything set to check against, so we needed to check for the image size and if it set show it otherwise show something else.

I'm glad its working for you now! :)


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ah srry thnx so mucvh u really helped


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
douglas
@douglas
11 years ago
2,806 posts
No problem, and your welcome! :)


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos

Tags