Mailing List Archive

image upload
Hi,
how on earth one can get such a message:

Error retrieving data from image.
upon calling:
$superg->upload_file($fh, "superg.js");

It crashes at Bric::App::MediaFunc::_get_image_info().

Even deleting and reloading $superg media doesn't help.
It's just a json object, nothing fancy, that I need to
update from template.

Any help very wellcome. Thanks, Zdravko.
Re: image upload [ In reply to ]
Hi Zdravko,

Bric::Biz::Asset::Business::Media::Image only likes actual image files.

If you're creating media assets using other file types, such as JSON,
you should use a Bric::BiZ::Asset::Business::Media object instead.

Hope this makes sense,

Bret

On Mon, 2012-01-16 at 15:44 +0100, Zdravko Balorda wrote:
> Hi,
> how on earth one can get such a message:
>
> Error retrieving data from image.
> upon calling:
> $superg->upload_file($fh, "superg.js");
>
> It crashes at Bric::App::MediaFunc::_get_image_info().
>
> Even deleting and reloading $superg media doesn't help.
> It's just a json object, nothing fancy, that I need to
> update from template.
>
> Any help very wellcome. Thanks, Zdravko.
>
>

--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret@pectopah.com
www.pectopah.com
Re: image upload [ In reply to ]
Hi Zdravko,

Bric::Biz::Asset::Business::Media::Image only likes actual image files.

If you're creating media assets using other file types, such as JSON,
you should use a Bric::BiZ::Asset::Business::Media object instead.

Hope this makes sense,

Bret

On Mon, 2012-01-16 at 15:44 +0100, Zdravko Balorda wrote:
> Hi,
> how on earth one can get such a message:
>
> Error retrieving data from image.
> upon calling:
> $superg->upload_file($fh, "superg.js");
>
> It crashes at Bric::App::MediaFunc::_get_image_info().
>
> Even deleting and reloading $superg media doesn't help.
> It's just a json object, nothing fancy, that I need to
> update from template.
>
> Any help very wellcome. Thanks, Zdravko.
>
>

--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret@pectopah.com
www.pectopah.com
Re: image upload [ In reply to ]
Bret Dawson wrote:
> Hi Zdravko,
>
> Bric::Biz::Asset::Business::Media::Image only likes actual image files.
>
> If you're creating media assets using other file types, such as JSON,
> you should use a Bric::BiZ::Asset::Business::Media object instead.
>
> Hope this makes sense,

It does, but $superg comes from:

% my ($superg) = Bric::Biz::Asset::Business::Media->list({ title => 'superg.js',
% 'site_id' => $story->get_site_id })

So, is here the $superg of proper type to run $superg->upload_file($fh, "superg.js")?

Regards, Zdravko
Re: image upload [ In reply to ]
On Jan 16, 2012, at 7:00 AM, Zdravko Balorda wrote:

> It does, but $superg comes from:
>
> % my ($superg) = Bric::Biz::Asset::Business::Media->list({ title => 'superg.js',
> % 'site_id' => $story->get_site_id })
>
> So, is here the $superg of proper type to run $superg->upload_file($fh, "superg.js")?

You sure about that? What does `ref $superg` show?

David
Re: image upload [ In reply to ]
David E. Wheeler wrote:
> On Jan 16, 2012, at 7:00 AM, Zdravko Balorda wrote:
>
>> It does, but $superg comes from:
>>
>> % my ($superg) = Bric::Biz::Asset::Business::Media->list({ title => 'superg.js',
>> % 'site_id' => $story->get_site_id })
>>
>> So, is here the $superg of proper type to run $superg->upload_file($fh, "superg.js")?
>
> You sure about that? What does `ref $superg` show?
>
> David
>
>

Indeed, it says: Bric::Biz::Asset::Business::Media::Image:

Please, help me converting this.

Zdravko
Re: image upload [ In reply to ]
On Jan 16, 2012, at 11:54 PM, Zdravko Balorda wrote:

> Indeed, it says: Bric::Biz::Asset::Business::Media::Image:
>
> Please, help me converting this.

Whatever media element type that is, you have the Image checkbox checked. Uncheck it. Then you'll need to delete that media document and create a new one.

Best,

David
Re: image upload [ In reply to ]
David E. Wheeler wrote:
> On Jan 16, 2012, at 11:54 PM, Zdravko Balorda wrote:
>
>> Indeed, it says: Bric::Biz::Asset::Business::Media::Image:
>>
>> Please, help me converting this.
>
> Whatever media element type that is, you have the Image checkbox checked. Uncheck it. Then you'll need to delete that media document and create a new one.
>

What do you mean by Image checkbox? It's Bricolage 2.0.

Regards, Zdravko
Re: image upload [ In reply to ]
On Jan 17, 2012, at 10:07 PM, Zdravko Balorda wrote:

>> Whatever media element type that is, you have the Image checkbox checked. Uncheck it. Then you'll need to delete that media document and create a new one.
>
> What do you mean by Image checkbox? It's Bricolage 2.0.

Sorry, not a checkbox. That’s what I get for trying to go from memory.

So you should have a bunch of element types in Admin -> Publishing -> Element Types. One of these is the type of your media document. When you created it, you selected what its content type would be. This would be one of Subelement, Story, Image, Audio, Video, or Other Media. This element type is clearly an Image.

So you need to use or create another element type with its content type set to Other Media. I usually call it something like “static files” or something, and use it for my CSS files, JavaScript files, etc. Then recreate your JSON media document as an instance of that type. You will likely need to delete the existing JSON media document if you want its URL.

HTH,

David