Bug #59216

Image dimensions (width/height) are 0 when not scaled

Added by Stefan Neufeind almost 6 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2014-05-30
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I have images inserted as media-references in page-records and use level-sliding for header-images with the below attached TypoScript. My source-images currently already have a width of 620 pixels, but could be larger would should be resized to maxW=620.

  • If source-image is larger (will be resized) all is fine.
  • If source-image already has the correct size, the img-tag will point to the original file - but width/height will be zero:

    <img width="0" height="0" border="0" alt="" src="fileadmin/someimg.jpg">

  • When I clear db-table sys_file_metadata and refresh the page, the img-width/height are added to the img-tag correctly.
  • When clearing the frontend-cache again, the size is zero again.

Experienced with TYPO3 CMS 6.2.3, which afaik should already have all fixes from #46020 etc.

obj.headerimage = FILES
obj.headerimage {
  references {
    table = pages
    #uid.data = leveluid:-1, slide
    #fieldName = media
    data = levelmedia:-1, slide
  }
  renderObj = IMAGE
  renderObj {
    file.import.data = file:current:publicUrl
    file.maxW = 620
  }
}

screenshot.jpg View (268 KB) Harald Dolderer, 2014-06-18 17:47


Related issues

Related to TYPO3 Core - Bug #46020: Image size is 0 when not scaled Closed 2013-03-04
Related to TYPO3 Core - Bug #62400: Lot of entries in sys_file_processed with name=NULL and identifier empty Rejected 2014-10-22
Related to TYPO3 Core - Bug #61181: FAL: file maxW and maxH are ignored Rejected 2014-08-25
Related to TYPO3 Core - Bug #44105: Image size does not get updated Closed 2012-12-19
Related to TYPO3 Core - Bug #45922: image replacement, width and height are kept even i change my image Closed 2013-02-28
Related to TYPO3 Core - Bug #46446: sys_file doesn't get updated Closed 2013-03-20
Related to TYPO3 Core - Bug #52658: Overriding image does not change the dimensions Rejected 2013-10-10
Related to TYPO3 Core - Bug #54533: imgResource.noScale doesn't scale image tag Rejected
Related to TYPO3 Core - Bug #58019: FAL Indexer for broken files: Column 'width' cannot be null Rejected 2014-04-17
Related to TYPO3 Core - Bug #62247: FAL: Uppercase File Extensions of Image cannot be displayed Rejected 2014-10-15
Related to FAL Indexing - Bug #60215: sys_file_processedfile with empty identifier and name fields Under Review 2014-07-09

History

#1 Updated by Stefan Neufeind almost 6 years ago

Workaround for the moment that works whether img needs to be scaled (processed) or not:

renderObj = IMG_RESOURCE
renderObj {
file.import.data = file:current:publicUrl
file.maxW = 620
stdWrap.wrap = &lt;img src="|" width="620"&gt;
}

#2 Updated by Markus Klein almost 6 years ago

AFAIK the fieldName property is required. Don't know if that is related though.

#3 Updated by Stefan Neufeind almost 6 years ago

Just found that I'm missing image-dimensions for other text-with-images as well. After clearing sys_file_metadata all is well, for a while.

#4 Updated by Stefan Neufeind almost 6 years ago

Clearing sys_file_metadata and running the scheduler-job "File Abstraction Layer: Extract metadata in storage" I get metadata written to the DB - but with 0x0 pixels. How come? :-(

#5 Updated by Frans Saris almost 6 years ago

Are you using a local or remote storage?

Could test what for results getimagesize() give you for one of the files? As that is used the get the image dimensions.

See https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Resource/Index/Indexer.php::extractRequiredMetaData()

#6 Updated by Frans Saris almost 6 years ago

  • Status changed from New to Needs Feedback

#7 Updated by Harald Dolderer almost 6 years ago

the link above is unfortunately broken.
Same problem with image dimensions 0 for me.
We are using a local storage.

#9 Updated by Frans Saris almost 6 years ago

@Harald, are the dimensions 0 in both database (sys_file_metadate) and in the tag (html source) or only in the tag?

Btw, please do not use:

  file.import.data = file:current:publicUrl

but:

  file.import.data = file:current:originalUid // file:current:uid

The the current file record is used. Else the file is again fetched by identifier the old way

#10 Updated by Harald Dolderer almost 6 years ago

@Frans: width and height are 0 in the table sys_file_metadata and in the html source code.
Gererating metadata with sheduler Task fills the table also with height and width equal 0

Your change in line file.import.data seems to solve the problem.
Thank you for your quick responce.

#11 Updated by Frans Saris almost 6 years ago

The metadata are only updated by scheduler if lastmodification date of file is newer than last_indexed of the corresponding sys_file record.

If you upload a new file in BE are the width and height of the new created sys_file_metadata record filled?

#12 Updated by Harald Dolderer almost 6 years ago

too early pleased.
clearing the cache next time same again.

#13 Updated by Frans Saris almost 6 years ago

Are you sure the width and height of sys_file_metadata are empty?

Did you do a clean install of 6.2 or an update from 6.0/6.1.

#14 Updated by Harald Dolderer almost 6 years ago

yes I'm sure.
See screenshot.
It's an update from 6.1.9

#15 Updated by Frans Saris almost 6 years ago

Did you run all upgrade wizards in install tool and remove all obsolete columns from sys_file etc?

#16 Updated by Harald Dolderer almost 6 years ago

yes, I tried, but there is another bug which prevents the update manager to finish.
https://forge.typo3.org/issues/59567

#17 Updated by Frans Saris almost 6 years ago

Could you check if the width and height column are still present in sys_file. That could cause your problems.

#18 Updated by Harald Dolderer almost 6 years ago

that's it. This columns are present in 6.1 and are missing in 6.2.
May I create this columns by hand or is there another solution?

#19 Updated by Frans Saris almost 6 years ago

see my comments for #59567 maybe you can proceed the upgrade then.

If you remove the columns by hand you lose all width and height values that are already in DB.

Btw. Columns should be missing in 6.2. These are move from sys_file to sys_file_metadata

#20 Updated by Markus Klein almost 6 years ago

The columns are present in sys_file in 6.1 and will be migrated over to the new columns in 6.2 on the sys_file_metadata table.
So you don't need these columns anymore in 6.2 after they've been migrated.

It is important that your run the migration wizards right after switching the TYPO3 sources.

#21 Updated by Harald Dolderer almost 6 years ago

o.k,removing indexed search solves #59567.
The upgrade manager is now running till the end.
But the main problem is still available.
Between Upgrading to 6.2.3 and now no sites and no content was created.
Nothing was installed in addition.
You think installed indexed search interferes the update?

#22 Updated by Frans Saris almost 6 years ago

The install tool database analyser doesn't show any columns to be deleted?

I find it strange that when you upload a new image the width and height in the new sys_file_metadata record are not set.

#23 Updated by Harald Dolderer almost 6 years ago

I didn't say this.
New uploaded images are displayed in the right way, but it is impossible for me to upload many hundred images again and connect them with the content elements or news records. The problem is: Images which are displayed in a right way in 6.1. have the dimensions 0 after updating to 6.2.
I think I try the update tomorrow without indexed search again and report here again.

#24 Updated by Frans Saris almost 6 years ago

Oh, I understood that also for new uploaded files width and height where 0.

Have a look ar #46020 for some hint how to get width and height filled again.

But I think if you clear the column last_indexed of sys_file and run the fal indexer scheduler task (indexer not the metadata task) the width and height values of sys_file_metadata should be set/filled.

#25 Updated by Harald Dolderer almost 6 years ago

unfortunately no.
importinig 6.1 database again and running the Upgrade withard again after patch7 from #57495 is installed solved the issue.
Now I am ready for a holiday. Thank's a lot for your help.
See also #57545

#26 Updated by Frans Saris almost 6 years ago

So you weren't on latest version of 6.2?

#27 Updated by Harald Dolderer almost 6 years ago

I was on latest version 6.2.3 but I made the update from 6.1.9 to 6.2.3 comletly new (with the obove mentioned patch7 installed). This solves my issue. After upgrade manager has run the file dimensions are available and the images are displayed in the right way.

#28 Updated by Alexander Opitz over 5 years ago

  • Status changed from Needs Feedback to New

#29 Updated by Mathias Schreiber over 5 years ago

  • Target version set to 7.1 (Cleanup)
  • Sprint Focus set to On Location Sprint

#30 Updated by Frans Saris over 5 years ago

  • Category set to File Abstraction Layer (FAL)

Steffen can this issue be closed?

#31 Updated by Stefan Neufeind over 5 years ago

@Frans: I guess you meant me? I currently don't have the usecase at hand anymore, to easily test again against a recent version.

#32 Updated by Fabien Udriot over 5 years ago

  • Status changed from New to Closed

#33 Updated by Anja Leichsenring over 4 years ago

  • Sprint Focus deleted (On Location Sprint)

Also available in: Atom PDF