creating a profile cover photo (1 missing peicce to the puzzle)

soaringeagle
@soaringeagle
11 years ago
3,304 posts
ill start off by saying this is my 1st attempt at using smarty to edit a template
i know it will get easier with practice but with a lil searching code comparing and braindead sleep deprived detective work (almost didnt want to give up trying i was so close )
i created a image upload field in the profile customization form and gave it the name profile_cover (note added profile tweaks already for profile background and logo)
now calling in the image made my head pound since id never worked with smarty before but peice by peice it started to come together
1st i was thinking i had to edit the templates with the template button on the profile customization thingy but no divs matched up so wentto the skin itself and found the right template tried multiple codes that gave screwy results finaly a lil searching and comparing and figuring out how it afected the url structure i managed to get this far

{jrCore_module_function function="jrImage_display" module="Profile" type="profile_cover" item_id=$_profile_id}

the url of the image is
http://greentechnologyforums.com/profile/image/profile_cover/1/medium/_v=1415322228
but my code only gets ne as far as
http://greentechnologyforums.com/profile/image/profile_cover/1/medium

where this comes from /_v=1415322228
i cant guess or figure out

but hey pretty damn proud of myself for figuring out as much as i did so far
(granted i did snag code from a forum post to deconstruct and reconstruct)


when u tell me the last peice of the puzzle can you also explain how to find it
i hate asking newb questions and want to learn this as i build the site
(poking around i did get a lil sence ofhow modules are made but will have to really study it when ive slept a bit)

in fact that will be my 1st project tomorow ..learn the smarty basics

so where oh where can i figure out where this came from /_v=1415322228

oh and right niw jhust trying to get tye image to display at all but i really want it as a background so can this be added to a inline style



--
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: 07/09/16 09:21:02AM
paul
@paul
11 years ago
4,335 posts
You need the full module name in the call -

{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_cover" item_id=$_profile_id}

The /_v=1415322228 bit you likely copied from another bit of code that needed the '$_post._v' option passing to it. Its not needed to display an image.


--
Paul Asher - JR Developer and System Import Specialist

updated by @paul: 12/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok you got me1 step closer i got the image displayed in the page within the divi wanted it as a bacground of (i know i pasted the code there as a test just to see if i can get ittio display) however trying to ise it as a background in an inline style wont work as it adds the


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok i give up
still cant get it to function as a background i thought jrcore_image as thge function might be whati needed

what i want is users to be able to upload an image which i got as profile_cover
then have that as a bacground
wait
maybe i shouldnt try as a bacground i think i got an idea
but a question on responsiveness

well i'll come back to that let me see if i cant work something elee out


--
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/29/14 09:23:54AM
douglas
@douglas
11 years ago
2,804 posts
There is a profile tweak module that allows your users to change the background on their profile page.

https://www.jamroom.net/the-jamroom-network/networkmarket/2/profile-tweaks


--

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

updated by @douglas: 12/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok check this out
http://greentechnologyforums.com/soaringeagle
ofcourse the custom logo was just a random file i tried as a test
but
i think the covrr photo looks sweet huh


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
dougleass already using that this was to be used in conjunction for a profile cover photo
it didnt work exactly as i i\envisioned but ..it worked out pretty sweet im still going to attempt to tweak the design a lil


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok 1 lil issue i thought that code would skip adding anything if no image was uploaded

is there a way that if u add a cover photo it shows up if nit theres nothing and nit that big ugly questionmark

or is there a way to replace the questionmark with a default 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/29/14 09:23:54AM
douglas
@douglas
11 years ago
2,804 posts
You could setup a custom field in the ACP > Profiles > User Profiles > Tools > Create New Profile > Form Designer.

Call the new field profile_cover_image and set these fields on the following screen.

Label - Cover Image
Type - image
Display Groups - (group) All Users (including logged out)
Active - checked

all other fields should be blank unless you want to use the help field.

Once that is done, you'll want to create/modify one for the "modify profile" form, its in the select drop down above the field list on the right.

Once you have both of those fields created/modified, you would use this to show the image in a profile_ template.

{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}

https://www.jamroom.net/the-jamroom-network/documentation/development/769/jrcore-module-function

Hope this helps! :)


--

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

updated by @douglas: 12/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
welp
now i gotthe big questioinmark on all profiles nbo io=option to upload one on edit only creation but wait i think i kl]know what i can do but im stikll seeing the big questionmark


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok hope i can reply now it wasnt lettingme
i got it so u can uploiad at creation or edit
but what i want to know is

can you definbe a statement that tests if the user has uploaded any images .. and if so place the image code
if not just skip it


--
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/29/14 09:23:54AM
douglas
@douglas
11 years ago
2,804 posts
Try this:


{if issset($profile_cover_image) && strlen($profile_cover_image) > 0}
image code here....
{else}
show something else here....
{/if}


Or this if you don't want to show anything if there isn't an image uploaded.


{if issset($profile_cover_image) && strlen($profile_cover_image) > 0}
image code here....
{/if}


Hope this helps! :)


--

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

updated by @douglas: 12/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
thnx i did manage to change the default pic from the ugly 1 to a cool 1 but not 1 that really should appear all over so the 2nd option should work

and for only playing with smarty code for a day i understand how that works ..i think i can pick this up rather quickly but till then you might get alotta newb questions..
though im the type that will want to be answering questions asap ...so im determined to figure it all out


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
now im also wondering lil off topic but if i could eventualy alow users an option to upload a stylesheet
im thinkimng of a checkbox that says use custom stylesheet if checked links to a second checkbox saying "i understand thart if i use non responsive code my profile may not appear coorectly on all devices' then if checked alows an upload feild for a css andmodify the template to use that instead of the defaults if it exists...

not asking for how to do it just ..will that be possible oncde im more confy with the coding


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok this is what im using but getting a syntax error
{if issset($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}


--
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/29/14 09:23:54AM
douglas
@douglas
11 years ago
2,804 posts
Try 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}



--

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

updated by @douglas: 12/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok bangs head against the wall
no syntax errors but now the image disapears on profiles that have 1 too


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
argh i thought i had it all figgured out thought
{if isset($profile_cover_image) && strlen($profile_cover_image) > 0}
could be
{if isset($profile_cover_image)}
no errors ..pic came back but so did defaults
i figured isset meant there was 1
and the strlen was unesacary..and messing it up
but still kinda guessing just getting used to the code

and why is it that with multiple tabs some tabs refuse to send the comments when i click post responce


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
added an {else} please upload a cover image
and i see that even though 1 was uploaded

does it matter that i uploaded/ i cant see why it wouldd but going to test it it through the form feild added to the modify profile not create profile page


--
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/29/14 09:23:54AM
douglas
@douglas
11 years ago
2,804 posts
Some things will get stripped out of a post if its not allowed.

If you want to put code in that doesn't get stripped, use the bbcode "[ code ] [ /code ]" tags.


--

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

updated by @douglas: 12/29/14 09:23:54AM
douglas
@douglas
11 years ago
2,804 posts
Are you working in developer mode with core cache setting set to 0? If not try clearing your cache via the ACP > System Tools > Reset Cache.


--

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

updated by @douglas: 12/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
developer mode yes ill set cache to 0 too but i have been doing hard refreshes too


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
caches reset i see the else so for some reason its skipping the code wether a pics uploaded or not


--
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/29/14 09:23:54AM
douglas
@douglas
11 years ago
2,804 posts
Stick a debug in the template and see if you can see the variable available.

{debug}



--

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

updated by @douglas: 12/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
you can see the results here
http://greentechnologyforums.com/soaringeagle
extention maybe?


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
yea its that strlen i tried every possible variable


--
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/29/14 09:23:54AM
soaringeagle
@soaringeagle
11 years ago
3,304 posts
dude thanks for all your help went into a coma like nap for an hour then figured it out
since default.png was a png i added
&& $profile_cover_image_type == image/jpeg
that made sence to me but did the oposite of whats expected so
changing == to != fixed it

i couldnt have done it without your help even if i ultimately figured it out myself

and for a 1st time attempting anything at all with smarty template mods i feel good that i figured it out even if it did take a very long time
i feel alot more confident now that i will have less issues with future puzzles


--
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/29/14 09:23:54AM

Tags