Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[SOLVED] SS3 Upload many files/images [SOLVED] Resize image if it's larger than a certain width


Reply


35 Posts   5597 Views

Avatar
Craftnet

Community Member, 58 Posts

25 July 2012 at 1:27am

@Hattori thx for replay

I have still problem with attach, the same like @Liam

Sorry for bad English

Avatar
Liam

Community Member, 470 Posts

25 July 2012 at 1:54am

I did a quick test yesterday with 1 image and it uploaded to the custom folder I specified. That didn't seem to be the issue. The issue was not being able to edit or remove them like shown in the screenshot I posted.

This happens with or without setFolderName(); being called.

Avatar
Craftnet

Community Member, 58 Posts

25 July 2012 at 5:34am

Edited: 25/07/2012 5:50am

@Liam Thx for the correct

Never mind

Avatar
Liam

Community Member, 470 Posts

25 July 2012 at 5:48am

I think I got this working now. Using the many_many relationship instead of has_many as I got the path error bug as well.

Then I removed the $this->Images() from the UploadField and everything is working and I can now edit/remove images attached to pages.

I did find another bug I think in that setFolderName() can't take spaces. When I use 'FolderName' it doesn't create a folder with a space in it like I thought might, so I tried doing 'Folder Name' and while it creates the proper name with the directory being 'Folder-Name' uploads fail for some reason. URL looks correct but always 404.

Avatar
Liam

Community Member, 470 Posts

25 July 2012 at 5:48am

@Craftnet The other topic is setup to use the name screenshot, your code isn't obviously. The names of the field have to match the db stuff.

Keep your latest code and switch the has_many to a many_many and then run dev/build and see what happens.

Avatar
Craftnet

Community Member, 58 Posts

25 July 2012 at 6:01am

finally :)

Thanks @thi3r
Thanks @Hattori
Thanks @Liam for the final solution

Avatar
Hattori

Community Member, 20 Posts

25 July 2012 at 2:24pm

@Liam: all physics files and folders are now converter automatically to alphanumeric characters and dashes

Avatar
Liam

Community Member, 470 Posts

26 July 2012 at 12:36pm

One last thing.

How do I access the variable in a loop?

I have this

<% loop Images %>
   <a href="$SetWidth(800).URL">$CroppedImage(160,160)</a>
         
$Image.Width
<% end_loop %>

$Image.Width is what doesn't work, everything else is fine. Tried a bunch of var names and nothing works.