last day (14 days later) » 

02:47
1
Q: Hope to get guide how to handle image upload & show

Samuel JanssonI am now working on one Meteor project and trying to do the below. I have a product list page and when I click one product, I goes to product edit page. What I want to know is how to attach product image and show it when I go back to product list page. I know CollectionFS used for file uploa...

You may check out yogiben:autoform-file which extends aldeed:autoform and makes the upload/download process quite easy. However, it has a few issues.
Hi Blaze, Thanks for your contact. I already checked yogiben:autoform-file package, but it seems there is no any detailed example which is similar with my case.
And what I've got while I use yogiben:autoform-file in edit page is this. {{> afQuickField name="name"}} {{> afQuickField name="picture"}} After saving, I've got this info. name: "Product #1" picture: "r2qaNCfvSSWZDRv7N" Now I need to show product image in list page by this picture string???
Did you publish Images from server? Check if you have any errors in your browser console.
I published Images from server, but where should I subscribe it?
You need to subscribe to it from anywhere in the client-side. If you only need the subscription in the current template, you can do a template.subscribe.
02:49
Here is the code snippets for product picture.
// products.html -- list page
{{#if all_products}}
{{#each all_products}}
<tr>
<td>{{name}}</td>
<td>{{picture}}</td>
</tr>
{{/each}}
{{else}}
<tr>
<td></td>
<td>There is no any products</td>
</tr>
{{/if}}
Because I have no idea how to show picture image,
I am doing doing it.
Hello,
I do have a repo about handle images using FS
maybe it could help you
Great, can you show it to me now?
02:57
It seems very good, but I want to get more specified solution.
here is the git repo that I am working on.
Here, instead of product, I hope to know how to add image into building so that I can see building images on list page, and edit individual building image in edit page.
In a word, I need to add one image per building and show it to building list page.
@Etha
@Ethaan do you have any source code for the demo I could check out?
hey i think i did something and block blaze for mistake
ohh i see
well i made a demo like 8months ago or something
oh it was 11months but it get the basics of uploading picture
Yes, that's really good source,
btw @SamuelJansson why dont you better switch to lepolezo or slingshot?
I didn't hear about leoplezo or slingshot yet?
03:04
well my first answer to you will be
where do you want to store the images?
database? file system? cloud?
I planned to use gridFS but that's ok if we use Filesystem now.
The important thing is to show product image in list view.
I tried to use yogiben:autoform-file
well i think gridfs is the best option or cloud
but I couldn't know how to show the product/building image in list view.
i dont like Filesystem
Yes, me too.
03:06
well i dont know whats the list view you are talking about
if you run my source by meteor run,
then you can see the localhost:3000 page.
it shows builidings.
github.com/sidkdbl07/GNWT-PWS
okay
amm let me clone the project
Ok,
I tried to solve image issue for a couple of days, but
because there is no any guide how to handle the image show in the case of mine,
I am getting suffering from it.
are you using some other package or what?
So, to get privilege of edit building, you can use this login info.
abcd
1234
1234 is password
and [email protected] is email for login.
And I am using cfs:autoform, cfs:filesystem & cfs:gridFS
03:10
ohh well
you are using autoform
and I am sure you prefer to use cfs:gridFS
i do really hate that package
i dont like to mess with that package honestly
its good for prototyping
but when you want to do stuff lIKE THIS, its a pain in the ass
my recomendation is to dont use it
Yes, I think so also.
03:11
you can use something like yoogiben or something
but then you are having something like " a package under a package"
wich become pretty easy in a mess
I thought yogiben based on autoform??
well its based on autoform on top of it
but its still a separated package
maintained from a different guy
Yeah, I know it.
aldded maintain autoform, yogibeen the other package
nooo thankss haha
so, anyway, how to handle this issue?
03:12
idk
i never use autoform
Can you give me a guidance what code I should use for building image show?
in list page?
with autoform? not sorry
I'll try to come up with a demo code, lets see.
Thank you very much, Blaze.
03:28
I've worked with yogiben's autoform-file and I had got it to upload and show a preview image. Sadly, I don't have the code right now. I'll be able to post an answer in 1-2hrs.
Thank you for your kindness.
You can use this code repo.
lemme know where the file-upload/display related code is located in the repo
now, it does not contain the code,
because I failed to image showing,
now it contains only the previous code to start.
So, at this point, What I want to know is how to show building images in building list that appears in localhost:3000.
and you can go to edit page after login,
and login info is
1234
because there is no any guide or tutorial how to handle this edit-list image show problem,
I hope to get your help.
I know you are the professional meteor developer and have great fame,
blaze-html-templates
It's yours, right?
Please help this newbee.
 
1 hour later…
04:56
Hi Blaze,
So is there any way to solve the issue?
05:18
I'm working on a demo implementation
Thank you really.
btw.. yogiben's autoform-file automatically shows a preview of the uploaded file. That's working right?
yes, that's working.
what I am getting suffer is to display the uploaded image on list page.
Because Yogiben's autoform-file does not show this case,
I hope to know how to realize it.
I've got it working.
It seems I was a bit wrong.. in that this is not an issue with yogiben's autoform. I'm posting an answer.
05:35
Great, I will check it soon.
Where can I find your answer?
On your question.
Ok, let me see.
Great, let me check now.
05:59
Hi Blaze,
Would you please offer me the source level solution based on my git repo?
Now I am still confusing how to make it acts.
This is that I've done.
// schema.js
Images = new FS.Collection("images", {
stores: [new FS.Store.FileSystem("images")]
});

Images.allow({
insert: function(){
return true;
},
update: function(){
return true;
},
remove: function(){
return true;
},
download: function(){
return true;
}
});

/////////////////////////////////////////////
// BUILDINGS
Buildings = Collections.Buildings = new Meteor.Collection("Buildings");
if (Meteor.isCordova) Ground.Collection(Buildings);

Schemas.Buildings = new SimpleSchema({
'name': {
type: String,
And I added publish into server/publish.js
Meteor.publish('images', function() {
return Images.find();
});
At buildings/buildings.js
i tried todo it.
you're going fine so far
:) As a newbee, I hope to get your help.
Ok,
here is the updated file that following your guide.
I'm a newbie too :P
But I am still getting error.
Could you please check the repo, especially buildings folder,
and tell me what I made wrong?
I'll check
06:07
Thank you very much
06:28
So where did I make wrong thing there?
06:40
I forked your repo. I'm trying to load localhost:3000 but dont see anything. Seems like a lot of errors on your console?
What I newly added is just <td><img src="{{this.url stores='images'}}" /></td> in buildings.html
and 'all_buildings': function() {
var buildings = Buildings.find().fetch();
buildings.forEach(function(each) {
each.picture = Images.findOne({_id: each.picture});
});
return buildings;
},
in buildings.js
You can remove buildings.forEach part and <img> tag to see the working page.
change this.url to this.picture.url
ok, let me check.
Wonderful, you are really great developer!
and mentor.
Thank you very much for your kind help.
Without it, I couldn't handle this issue.
Did it work?
06:51
I'm seeing some errors regarding this.next() though
?
let me check.
"Exception in callback of async function: TypeError: this.next is not a function"
this is being thrown from gnwt.js
hmm... because I am still not so familiar with meteor, I guess I made something wrong on it.
Anyway, let me check now.
However, this problem is related to Iron Router and not image uploading/displaying.
So if image upload/display problem is solved, do accept my answer :)
yes, you gave me really great help.
I will accept your answer soon and tell my friends to support you.
06:57
ah thanks
my pleasure
you are really great person!
I try to be :P
in gnwt.js you are calling this.next() in both Router.before and Router.onBeforeAction
I will check it soon .
 
8 hours later…
15:19
Hi - I am using a meteor application forked by github to my desktop, I installed additional packages (local) and deployed it to heroku but on heroku the new packages were not considered, do I need to update something (local it works but after the deployment not)

last day (14 days later) »