Closed (fixed)
Project:
ImageField
Version:
5.x-2.0-rc8
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2007 at 23:01 UTC
Updated:
26 Oct 2016 at 17:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
juanfe commentedI'm seeing the same issue, version 1.30.2.7 of imagefield.module.
I think the problem is in line 393 of imagefield.module compounded with an incorrect handling of the tmp file in preview mode.
When you upload a file, the file is created in the /tmp directory with a gobbledygook name. When you save the node after uploading the file, the file gets moved over to the /files directory and named according to what you uploaded.
The thing is, the imagefield.module lists the path for the preview as pointing to the image in the /files directory, not in the /tmp directory -- and by definition, if it's in preview mode it hasn't been moved over to permanent storage/hasn't been confirmed. So the gray line that displays is the equivalent of the "Page not found" message from Drupal.
This is compounded by the fact that there is what seems to be a bug in line 393 of imagefield.module. The module prepends 'system/files' to the filepath before it is passed to the preview item of the form element. However, upload.module also adds system/files/ to the path for an uploaded item -- meaning that the system component of the path is duplicated and shows up in the source for the preview as
http:///system/files/system/files/image.gif -- which also generates a "page not found"
If you try to pull up that URL directly, nothing will display. If you comment out line 393, the path will resolve properly IF the file is in /files directory -- but will still show up as gray bar because it's referencing a file that doesn't yet exist in the path.
_upload_prepare in upload.module has some code that unmunges the tmp filename for preview. I'm not sure if the code in _imagefield_preview is functioning properly. This is, unfortunately, the extent of my knowledge--I'm just not clear enough on how the module works to debug it further.
Juan Felipe
Comment #2
joetsuihk commentedcannot reproduce the problem using either 1.x HEAD or 1.1
on cck 1.5
test on WINXP, apache, mysql, localhost/drupal/
fresh install drupal, nth configured.
created a new content type with just one image field, nth configured except the required fields.
clicked "upload" and the page submit(refreshed), image appear normally
and the image is there.
note that there is nth in /files before "submit", but the HTML shows the image is from /files
after "submit", the image file appear in /files
problem may be from permission of tmp files on *nix OS?
Comment #3
joetsuihk commentedhello, some update after i try the issue http://drupal.org/node/159037
by setting the path of images to upload,
if you entered a leading slash to the path, for example, "/images"
will show a gray bar only before submit.
is it the case?
Comment #4
juanfe commentedHi there,
Permissions in my tmp directory are set to world read (running on apache, mysql, *nix).
Using Firefox and Safari, see error in both -- the src="" attribute for the preview image is referring to an image that doesn't exist in the /files directory (but that would after clicking "submit").
Is the image you are uploading to verify one that already exists in /files?
Juan Felipe
Comment #5
platypus media commentedThis seems to be happening for me as well. Oddly enough, this only happens "sometimes." Some images go up without a problem, while others are impossible to upload. Is there some sort of dependency on the file itself that I'm missing? No matter what I name one of my images (a jpg photo), it will not upload at all, while others, if I keep trying, eventually, it will upload.
Has there been any movement on this bug?
Mike
Comment #6
teagle commentedCCK: 5.x-1.5
imagefield: 5.x-1.1
tmp and files permissions: 777
download method: public
imagefield configuration in this content type:
- maximum resolution: 0
- image path within files: tried both images and /images
- custom alt + title: yes
- display in a group
- not required
- not multiple values
I get the same problems with imagefield in a custom content type - both on a localhost version of the site (Win XP + XAMPP + Drupal 5.1) and on the production server. In neither case is Drupal in the root folder.
All was OK at first; then I got an empty preview but the image was ok on the published page; now nothing is OK anymore... screenshot here: http://thomaseagle.com/imagefield_problem.jpg.
Sometimes the preview image shows up in edit mode after I "upload", sometimes I get the grey line of the border but no image, I always get the filename. My temp folder has a few files in it. The photo never goes through to /files/images where it is configured to go, and then on the next reload the node edit page shows imagefield empty.
I even tried uploading the image file by ftp to the right folder (files/images, permission 777) so that it would already be there when imagefield tried to link it, and this ensures that the preview image shows up and enacts the rewrite rule so the new image that's the same as the old one doesn't overwrite, but still the image doesn't appear when published.
In my log files I get "Page Not Found" messages for the images at syntactically correct urls from the referrer node/add/event.
If there's anything else I can do to help, let me know.
Comment #7
p_palmer commentedI am also experiencing this issue. I noticed that although the image[preview] markup is output, the actual
path is wrong, on my win32 dev system, the path = html path + OS type path; so there is a request for a non existing image at...
http://hbn/files/imagecache/head-preview/C:/apache2triad/temp/tmp2850.tmpnotice how two separate path types are concatenated together, maybe this is a bug in the fieldimage_js ??
config...
cck version = "5.x-1.x-dev" -- where, content.info,v 1.2.2.3
imagefield.info,v 1.4.4.1 -- imagefield version = "5.x-2.x-dev"
public files enabled
Comment #8
p_palmer commentedjust to clarify, this issue arises when the preview button rather than submit is pressed.
Comment #9
ms2011 commentedExperiencing the same problem, but discovered it was being caused by another module, "Remember Me" which [unintentionally?] clears the $_SESSION after every page load. For details, see: http://drupal.org/node/141418
Comment #10
mykle commentedFWIW i'm having the same problem in drupal 5.2 with imagefield 5.x-1.1 . Image doesn't show up after clicking 'upload' or 'preview', but does when clicking 'submit'. i am also unable to upload a user account picture with account pictures enabled. maybe that's a clue?
i don't have Remember Me installed, but i have a lot of modules.
Comment #11
p_palmer commentedI dont use 'remember me' and the issue was still present (I removed the preview button). Nice heads up tho, in terms of the session info, when you removed 'remember me', did everything work as expected?
Comment #12
douggreen commentedMany of the images in my {files} table have the file_directory_path() prepended to them. In this case, the
file path doesn't work. The attached patch strips the redundant file_directory_path() from the path.
Comment #13
trogie commentedlooks like this last patch is for another module imagecache?
I'm also experiencing the problem that newly uploaded images are _sometimes_ not previewed. I have the impressions that 'smaller' images are previewed while the 'bigger' ones not. I'm trying to see what the exact problem could be.
Comment #14
douggreen commentedDoh, sorry, you're right. Please ignore the last patch.
Comment #15
gagarine commentedYeah i have the same issue withe just:
-image filed + ckk
-view
The url as a false target and don't point on the tmp folder... like it's write in the http://drupal.org/node/155726#comment-273743 comment.
Comment #16
jmlane commentedSame issue: after upload, not image is displayed, only the grey bar where it should be.
If you look at the HTML generated, the module is apparently looking for the image in the wrong place.
<div class="imagefield-edit-preview"><img width="150" title="" alt="" src="http://xxxx/system/files/system/files/affiliates/englogo.gif"/></div>The directory I have my images going is "affiliates" in the field configuration. That would put it in the "drupal/sites/xxxx/files/affiliates" folder, which is correct (image gets uploaded to that folder). Public write/read permissions are set as well.
I am running CCK 5.x-1.6-1 and imagefield 5.x-1.1.
Comment #17
carsonh commentedSame issue here- tried all imagefield versions including dev versions - in each case the same.
Comment #18
trogie commentedWell, as I said in comment #13. I usualy don't see the previews when I upload bigger pictures then the maximum settings. Recently I've always resized my pictures to 1600x1600 before I upload them (less bandwidth) and never had this problem anymore.
Comment #19
dnbsecrets commentedthere seems a bug with gzip output compression & firefox.
when u output gzipped compressed binary data to firefox.
so that's actually not a bug of drupal or imagefield.
i have the same problems with imagecache also
that outputs also images with php.
Comment #20
baja_tz commentedProblem still exists and is not about compression but in path. So, image is not visible after clicking on upload button and it's path is:
http://my_site/files/pictures/misc27_0.jpg
At this moment image is still in temp directory and in my case has name "tmp4.tmp". After submiting node, image is visible because it's transfered from /temp to /files/pictures directory, named as it suppose to be (misc27_0.jpg) and path is correct. Is it possible to set path to /temp for uploaded images before submiting node especially if we don't know what is the image name in temp directory?
drupal 5.2
imagefield 5.x-2.x
method:private
Comment #21
gmuehl commentedI've just run into the same problems, for the momemt i've found a bug in the function _imagefield_widget_prepare_form_values which is reproducable. if you use the public download method everything is fine, if you use the private download method this function willl generate a path with /system/files/system/files/ in it.
There is some other kind of Bug which is allready mentioned. The uploaded Picture ist moved to the files-directory too late. The Preview will not work, but if you save the new Node everything is fine.
Comment #22
baja_tz commentedConfirm that it works with public method.
Comment #23
olalindberg commentedHaving same error (I think). Any resolution available?
Update: I reinstalled Drupal, Apache, Mysql etc on a new server and my problem went away... Have no idea why though..
Comment #24
moshe weitzman commentedStill busted, AFAICT
Comment #25
sunnyjiap3 commentedIt seems that if the file system is set to private, the upload preview won't work.
Comment #26
changjen commentedHi All,
Not sure if you have this fixed or if this is the same problem, but, I was having the following problem --
1. file settings as private
2. hit upload
3. instead of seeing the picture, I see a thin grey line.
I made the following change:
You can see the difference by diffing it with theme_imagefield_image. The only difference is if it is upload, stripping out the system/files/
I seem to see the image now when I hit upload.
Comment #27
esolano commentedI have the same problem...
changjen, what you posted is related... that patch works fine after uploading the image using 'Download method' as Private, but when switching back to 'Download method' as public, the image doesn't show anymore. And in both cases the image doesn't appear on the preview page after clicking on the preview button; showing only that gray bar mentioned above.
This is the broken url I get on the preview page:
http://xxx/files/imagecache/100x100//tmp/tmp_qaSOUs
where xxx its my server
If I open the /tmp folder, the temp file tmp_qaSOUs is there... but the url seems to be broken, I don't know why this is happening...
If anyone out there has fixed it, please post how you did it! that would be very helpful!!!
CCK: 5.x-1.5
imagefield: 5.x-1.1
tmp and files permissions: 777
download method: public
imagefield configuration in this content type:
Comment #28
dellis commentedI've also noticed this problem--sometimes.
For what it is worth, as Admin user, I get the little gray bar instead of a picture the first time around--if I go through the upload process for a second time, the image always uploads successfully.
If however, I am not an Admin user, when this error shows up (and it only shows up sometimes) the image doesn't get uploaded... and in IE7 instead of the gray bar, I get an image element that is the wrong dimensions and is referencing some non-existent image file (the empty img bordering box with the red "x" in the corner). Non admin users, when this bug occurs are unable to upload the image at all. Most of the time, the images go up without a problem, but only sometimes they have issues....
Comment #29
esolano commentedI think I came up with a solution to the preview issue... perhaps not the best; but it works for me (on a Linux distro).
The thing is that when setting the temporary directory to /tmp under Site Configuration -> File System you are telling drupal to use the tmp directory of the OS; and somehow, the preview page can not get to that directory... it doesn't find it, resulting on a broken url; which in my case is:
http://serverx/files/imagecache/100x100//tmp/tmp_1MbkQv
As you can see there, after the 100x100/ it tries to look for the temp image on the /tmp directory of the OS but somehow (don't know why yet) it doesn't find it.
So what I did was change the temporary directory under Site Configuration -> File System to files/tmp telling drupal to use the temporary directory of the drupal installation. The url is now as follows:
http://serverx/files/imagecache/100x100//home/esteban/workspace/serverx/...
The url is still broken, but is because the path of the temp image was set wrong... instead of /home/esteban/workspace/serverx/files/tmp/ (the physical path on my HD), it should be just /files/tmp/ which is the path that drupal recognize.
So after that, on the tpl file where the preview page es rendered, i strip the part that drupal doesn't recognize, resulting on a new path as follows:
The resulting url on the preview page is:
http://serverx/files/imagecache/100x100//files/tmp/tmp_1MbkQv
which is no longer a broken URL... the imagechace module now finds it; resize the temp image to 100x100, and now it finally appears on the preview page.
I hope this long post helps anyone out there! perhaps it would help some more experienced drupal programmer to find the root of the bug and fix it!
Comment #30
floretan commentedWe recently had the same issue on one of our projects, and it turns out that it's not a bug in imagefield but just a certain behavior that you need to be aware of:
1. In order to work with imagecache, which most people use in combination with imagefield, the temporary files folder must be *inside* of the files directory, like 'files/tmp' (this setting can be adjusted at http://example.com/admin/settings/file-system).
2. When a new image is uploaded, its path is stored under
$node->field_icon[1]['filepath']instead of$node->field_icon[0]['filepath']as it usually is. So if you are using a custom node template, you need to make sure that you are getting the first element of the array:Comment #31
drupalprojects commentedI think I've fixed it. See attached file. maybe someone will create a patch, based on it.
Comment #32
robotjox commentedhey guys,
none of the above worked for me, but I made some progress with an ugly hack that I submitted to another issue: http://drupal.org/node/215873#comment-714530
Hope somebody can turn it into something decent :)
Comment #33
leokyle commentedto me the problem seems to happen only if a new path is given for the image, at the field configuration. Since i didn't really needed it, i just removed the optional path to solve the issue. So it means its some problem when displaying from the optional path. I havent seen the code yet.
Comment #34
dopry commentedOk so everyone has jumped in this issue with a me too.... unless you are absolutely certain you are experiencing the same issue that is being reported open your own issue with details of your setup. i'm closing this issue sense it is too noisy for me to make any sense of it. If you are still having issues with imagefield 1.x-dev, please open an issue of you own with the details of your installation and directions to reproduce your problem.
.darrel.
Comment #35
markDrupal commentedI have experienced this same problem When I upload a new image, a temp file is created in the temp directory, but the gray bar is displayed where the thumbnail should be.
my browser tries to load an image:
http://mark.org/files/market/markc09/NEC_0001.JPG
however that image is not located there.
When I hit the submit button on the node, an image is created at that location and I can reedit the node and the gray bar no longer appears.
Comment #36
parrottvision commentedI also only have the problem sometimes. And when I re upload it works. But there are other fields missing in the first save. I have considered it being tmp file or a time out in the save of the content. Tried all the RC including rc8 with no change...
Comment #37
Tim Chan commentedI solved this problem by enabling Clean URLs.
First, edit Apache's httpd.conf file (for XAMMP users, it should be in xampp\apache\conf\).
Then delete # in the line "#LoadModule rewrite_module modules/mod_rewrite.so".
Restart Apache.
On your Drupal site, go to Administer/Site configuration/Clean URLs and run the test.
Finally enable Clean URLs and you're done.
Comment #38
parrottvision commentedI have clean URL's enabled. Not a fix for me sadly.
Comment #39
dopry commented@all, especially you who posted comments #35->38 read my last comment #34
Do Not Reopen this issue.. get your own!!
Comment #40
shenzhuxi commentedfix it by editing php.ini
Change this line
allow_url_fopen = off
to
allow_url_fopen = on
Comment #41
trogie commentedand I solved the same issue by removing the trailing slash in the 'Image path' in the configuration of the fields for my content-type with imagefield.
Comment #42
kemi commentedI had this same problem and it turns out that my options in .htaccess were preventing me from uploading and seeing images. I had to ask my host to configure it for their server.
Comment #43
wsxian commentedI have had the similar problem in that my images would not show - not even my logo!
I tried a lot of things.
I contacted the system admin for our website (our ISP) and he changed the permission on this directory to 755 (err - group permission to execute, read, read)): /drupal/sites/default
That did the trick!
My images, including my logo now show! (my images did import correctly prior to this and were located, along with the logo in /drupal/sites/default/files)
The system admin directed me to this: http://drupal.org/node/34025
Comment #44
kalyan_hb commentedI have added and configured the image field for basic page in content types. The image shows as getting uploaded but still my image shows in my front/home page only. The other pages like 'about' or 'portfolio' the image doesnt show. I have got Drupal 7.
I have already done the following:
1. I have added the 'img' tag for 'filtered html' ( input formats)
2. Selected the 'alt' option for the image field option.
3. Also added a destination directory for loading images in manage fields.
Please let me if anybody has any idea how to solve this.
Comment #45
cblackmon commentedFor anyone that is having this problem, what worked for me (very similar to #40) was to:
1. Go to my php.ini file
2. Change "allow_url_include = Off" to "allow_url_include = On"