Image upload-Song form field

johnchansa
@johnchansa
11 years ago
195 posts
I want to create an additional image upload field on the song form.I want to associate it with the song label.Can it be done in JR 4?
updated by @johnchansa: 12/29/14 09:14:37AM
douglas
@douglas
11 years ago
2,791 posts
Since there isn't a way to add a custom audio form field to upload files in JR4, you would need to create a custom module to do this.


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
michael
@michael
11 years ago
7,719 posts
Image upload cant be done using custom form fields in JR4, but you could allow the input of a URL.

Get use that url to point to an online image of the song labels logo perhaps.
johnchansa
@johnchansa
11 years ago
195 posts
Thats sounds interesting.What code can I use to let jamroom show the image?I guess you have to use the image.php function
paul
@paul
11 years ago
4,326 posts
Just use in your song template(s).
Change 'SONG_IMAGE_URL' to whatever you call your custom field.


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
11 years ago
7,719 posts
to elaborate on what paul said:
<img src="{$SONG_IMAGE_URL}">

My only reservation with that code is if you allow the user to input anything, they can put any url in there and call in other scripts to your site that could be used for an attack.

If there are a limited number of labels images, i suggest that you create a dropdown list of those labels then use that instead.

so create a 'select choice' custom form field with the labels names:
label1
label2
label3

then use this code instead:
<img src="{$JAMROOM_URL}/images/labels/{$SONG_LABEL_IMAGE}.png">

safer.
johnchansa
@johnchansa
11 years ago
195 posts
Thanks micheal...I will give that a try
Basically what I have is a producers list on my JR4 site(click producers on www.zmusicportal.com).
I customized the JR4 Albums module to achieve this.The module displays the band image to the listing:

$_rep['PRODUCER_IMAGE_URL'] = "{$aurl}/image.php?band_id={$_row['band_id']}&song_id={$_row['song_id']}&mode=band_image";

I wanted to change the band_image to something like song_label_image(...song label image).Using the custom form field,I have field created and the database also contains this column.I'm trying to link this field to the code above..
updated by @johnchansa: 11/28/13 06:16:09PM
michael
@michael
11 years ago
7,719 posts
Yeah thats getting a bit more tricky.... the first thing that comes to mind is this:

[code]
{if $SONG_LABEL_IMAGE == 'label1'}
<img src="{$JAMROOM_URL}/image.php?band_id=5&song_id=22&mode=band_image">
{elseif $SONG_LABEL_IMAGE == 'label2'}
<img src="{$JAMROOM_URL}/image.php?band_id=90&song_id=165&mode=band_image">
{elseif $SONG_LABEL_IMAGE == 'label3'}
<img src="{$JAMROOM_URL}/image.php?band_id=458&song_id=252&mode=band_image">
{/if}[/code]

So use the selection system of
label1
label2
label3

in your custom form field still, but go and get those lables image urls (the band_id and song_id that makes their image show up) then in the template put that piece of code above so that it switches the images depending on what the user has selected.


[code]

Tags