我有这个问题
我在我的模特服务中有这个
class Service < ApplicationRecord
belongs_to :user
has_attached_file :images, :styles => {:md => "300x300>", :large => "500x500>" , :xl => "700x700#"}, :default_url => "/app/assets/images/thumb/missing.png"
validates_attachment_content_type :images, :content_type => /\Aimage\/.*\Z/
end
这在我看来服务#index
<div>
<%= image_tag service.images(:md)%>
</div>
但是我的视图中存在一个问题,当我放置:large或:xl但是当我放置时:md图像没有显示。我不知道发生了什么
答案 0 :(得分:2)
如果在您的索引视图中将SqlConnection myDBCon = new SqlConnection(sc);
SqlCommand command = new SqlCommand("select Caption_name from Commercial_caption", myDBCon);
myDBCon.Open();
SqlDataAdapter mySqlAdapter = new SqlDataAdapter();
mySqlAdapter.SelectCommand = command;
DataSet ds = new DataSet();
mySqlAdapter.Fill(ds);
DropDownList1.DataSource = command.ExecuteReader();
DropDownList1.DataTextField = "Caption_name";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, new ListItem("--SELECT--","0"));
myDBCon.Close();
和:large
替换为:xl
时,:md
和:md
工作正常,那么我猜测根本没有可用的:md
版本。在您实际上传图像后,您是否已将<loc:WrapPanelWithRowsOrColumnsCount
xmlns:loc="clr-namespace:..."
Orientation="Vertical"
RowsOrColumnsCount="2">
<TextBox Text="Andrew" Margin="2" Height="30" />
<TextBox Text="Betty" Margin="2" Height="40" />
<TextBox Text="Celine" Margin="2" Height="20" />
<TextBox Text="Dick" Margin="2" Height="20" />
<TextBox Text="Enron" Margin="2" Height="30" />
<TextBox Text="Felix" Margin="2" Height="20" />
<TextBox Text="Hanibal" Margin="2" Height="30" />
</loc:WrapPanelWithRowsOrColumnsCount>
添加到模型中?我会删除图像并再试一次。