#1 2013-02-19 16:45:17

dedurus
Member
Registered: 2013-02-06
Posts: 11

[Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

Hi

I've recently upgraded Ionize to latest stable v0.9.9.2. In previous installation the FileManager wasn't working, and this was solved with the upgrade.
Now I can upload files (images) but cannot link them to page. Or a better explanation of the problem:
I already linked images to some pages , and in images tab no image is listed. If I try to link the same image to same page I got "Media already linked" message. If I try to unlink media with "Unlink all pictures" i got "No element to unlink !" message.

Is there any additional step on upgrading that has to be taken to solve this?

Last edited by dedurus (2013-02-21 00:18:55)

Offline

#2 2013-02-19 17:09:58

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

@Michel-ange, is there a link with this post and previously mine, i saw you had rewrite the call to admin url in 0.0.9.2 release ?


Webmaster / OUF!WEB

Offline

#3 2013-02-20 06:14:06

dedurus
Member
Registered: 2013-02-06
Posts: 11

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

Seems that the problem lies in `media` table and code responsible for inserting media data after upload through Filemanager. Although the upload goes fine, in `media` DB table it isn't recorded at all.
So, when linking data to page, in `page_media` table, the `id_page` has the right page ids, but `id_media` column is zero (0) on every row.

Offline

#4 2013-02-20 06:26:57

dedurus
Member
Registered: 2013-02-06
Posts: 11

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

These are AJAX responses when linking media after upload:

http:// www . website.com/en/admin/media/get_media_list/picture/page/17

{"message_type":"success","message":"Media linked","update":[],"callback":[],"type":"picture"}

http:// www . website.com/en/admin/media/get_media_list/picture/page/17

{"message_type":"success","message":null,"update":[],"callback":[],"type":"picture","content":"\n\t\t<div class=\"picture drag\" id=\"picture_5\">\n\t\t<div class=\"thumb\" style=\"width:120px;height:120px; background-image:url(http:\/\/www.website.com\/en\/admin\/media\/get_thumb\/5\/1361334966);\"><\/div>\n\t\t<p class=\"icons\">\n\t\t\t<a class=\"icon unlink right help\" href=\"javascript:mediaManager.detachMedia('picture', '5');\" title=\"Unlink media\"><\/a>\n\t\t\t<a class=\"icon edit left mr5\" href=\"javascript:ION.formWindow('picture5', 'mediaForm5', 'default_header_2.jpg', 'http:\/\/www.website.com\/en\/admin\/media\/edit\/picture\/5\/page\/17', {width:520,height:430,resize:false})\" title=\"Edit\"><\/a>\n\t\t\t<a class=\"icon refresh left mr5 help\" href=\"javascript:mediaManager.initThumbs('5');\" title=\"Init thumbnails\"><\/a>\n\t\t\t<a class=\"icon info left help\" title=\"5 : default_header_2.jpg\" rel=\"1024 x 360 px<br\/>49.55ko\"><\/a>\n\t\t\t\t\t<\/p>\n\t<\/div>\n\n"}

The image 'default_header_2.jpg' is previously linked to the page. I added it by hand in `media` table and the linked to page from backend without problem.

Last edited by dedurus (2013-02-20 06:27:51)

Offline

#5 2013-02-20 12:40:38

Michel-Ange
Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927
Website

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

@dedurus : No.
The reported bug is a refresh bug. You can't add the thumb content "by hand", that's ugly.


Inspiration & Innovation : Websites by Partikule, Agence Web Paris

Offline

#6 2013-02-20 13:29:24

dedurus
Member
Registered: 2013-02-06
Posts: 11

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

I  added uploaded photos to `media` table with own ids, and then linked them to pages from backend. So the problem isn't at  linking. 
So is there any solution?

Offline

#7 2013-02-20 17:05:54

Michel-Ange
Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927
Website

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

I'm sorry, but I don't understand what you'e doing.

You problem concerns the media linking from page editing panel, right ?

If yes, this feature works perfectly, so the problem on your install can come from one missing column in the media table.
Can you check the Firebug requests and see if one gives an error ?

In all case, hacking the core like you done it is strongly not recommended because :
1. You loose compat. with future version
2. Sending HTML to js CB is not the Ionize spirit.

Anyway, the normal linking process :
1. Adds the media info from file to the DB
2. links the added media ID to the parent (page or article) through the <parent>_media table.
3. Refresh the media list by calling the controllers which gets the media list


Inspiration & Innovation : Websites by Partikule, Agence Web Paris

Offline

#8 2013-02-20 19:56:55

dedurus
Member
Registered: 2013-02-06
Posts: 11

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

Sorry, I have badly explained the issue.
This is the flow:
- On page editing panel, i click Add Media, and then choose an image to upload. Uploading works fine
- When I click on the uploaded image and then click "Select File" in order to link it to the page, I got a message "Media Linked", but no media is listed on images panel. If I try to add another (or same) media, the error message is "Media already linked"
So the file (image) is uploaded and stored in "files/" folder, but no record is inserted in `media` DB table.
In `pages_media` table, the page ID is inserted but for media ID the cell is 0 (zero), since no media record exists in `media` table
For the purpose of the website I'm building, I have manually inserted records for uploaded medias (images) in `media` table and then, from admin panel I linked them in pages without problem.
I haven't touched the core.
Also, the `media` table columns are fine (nothing is missing)

This came from FireBug:

POST site_url/en/admin/media/add_media/picture/page/PAGE_ID

{"message_type":"success","message":"Media linked","update":[],"callback":[],"type":"picture"}

GET site_url/en/admin/media/add_media/picture/page/PAGE_ID

{"message_type":"notice","message":"No linked image","update":[],"callback":[],"type":"picture"}

These responses are the first time when I upload an image and try to link it.

IF I try to link already uploaded image:

POST site_url/en/admin/media/add_media/picture/page/PAGE_ID

{"message_type":"error","message":"Media already linked","update":[],"callback":[]}


I assume the GET gives error since the POST isn't inserting record to `media` table.

I would check in the core if had time

Last edited by dedurus (2013-02-20 20:00:29)

Offline

#9 2013-02-20 23:55:47

toopixel
Ionize Core Team
From: Geneva
Registered: 2010-04-20
Posts: 272
Website

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

Solution: Top menu Tools > System Diagnostic > Tools tab and run all cleaning scripts. Worked like a charm as you can see here http://www1.ascor.ch/plus-values wink


Too Pixel is a web agency located in Geneva, Switzerland

Offline

#10 2013-02-21 00:19:23

dedurus
Member
Registered: 2013-02-06
Posts: 11

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

Thanks a lot, marked as solved

Offline

#11 2013-02-21 00:41:01

Michel-Ange
Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927
Website

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

@dedurus :
Can you please reproduce the problem ?

The fact is you made a migration and the data you finally got in the tables create a conflict and I can't see which one.
Normally, if one media is already linked, you should see at least one media in the media list, even the thumb is not generated.

Can you please :
1. Do the upgrade you done again
2. Come to the bug status
3. Send me one zip of the DB and the website


Inspiration & Innovation : Websites by Partikule, Agence Web Paris

Offline

#12 2013-02-27 02:16:53

Michel-Ange
Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927
Website

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

Problem solved.
Was a DB table problem, the media couldn't be added to the table because of one missing table field.


Inspiration & Innovation : Websites by Partikule, Agence Web Paris

Offline

#13 2013-02-28 13:49:21

tomek
Member
Registered: 2012-03-14
Posts: 9

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

hey Michel-Ange, long time not on-line... Im glad ionize is evolving!

I have a little problem with media though,
I installed from scratch ver .9.9, it was working fine on the back-end, but in the front-end the thumbs of images were linking to a URL with the lang part, so instead of being: url.com/files/image.jpg - it was url.com/en/files/image.jpg,
I had no idea how to get around that problem so deleted the whole version and installed the newest .9.9.2 from scratch yesterday,

now I have two problems:
1. similar to what dederus wrote - I cannot link media to any article nor page - it says once "media linked" and then it gives same status "media already linked" when I want to link other images - but in the article itself there is no media linked anyway
2. before even linking the media, when I try to uplad the files, they are always uploaded to folder "files" even though in the previous versions it was possible to upload the files into subfolders - now I have to manually move the files to subfolders (I like to have my images oranized)

3. I cannot check whether now the media in the front-end show the right url (without the lang part in it)...

Id really appreciate your help,
regards

Offline

#14 2013-03-01 10:20:01

norikoman
Member
Registered: 2012-10-11
Posts: 16

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

I have the same problem. After upload the images (the file is upload but no record in media DB table) then click the select file button....(seems no response).

I check the response by Firebug. It shows as follow:

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4 style="color:#c00;">A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined index: path</p>
<p>Filename: admin/media.php</p>
<p>Line Number: 940</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4 style="color:#c00;">A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined index: file_name</p>
<p>Filename: admin/media.php</p>
<p>Line Number: 944</p>

</div>{"message_type":"error","message":"Source file not found : ","update":[],"callback":[]}

Last edited by norikoman (2013-03-01 10:50:13)

Offline

#15 2013-03-01 19:52:49

dedurus
Member
Registered: 2013-02-06
Posts: 11

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

Guys, you should install Ionize 0.9.9.2 from scratch and everything will work fine.

If you're upgrading, you should follow instruction, especially about the database upgrade

Offline

#16 2013-03-04 06:46:51

norikoman
Member
Registered: 2012-10-11
Posts: 16

Re: [Solved] Cannot link media (image) to page after upgrading to v0.9.9.2

The database problem. Solved now. Thanks.

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations