"Unable to locate image" error when trying to add an image ad

Kevin.K - April 27, 2009 - 14:58
Project:Advertisement
Version:6.x-2.0
Component:ad module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:fixed
Description

I upgraded to the new version 6.x-2.0 from the previous version (which was working fine).

Now when I try and add a new Image advertisement, I get a message "Unable to locate image" after I fill out the Create Advertisement page. I have tried with various images that I have used before, tried adding them to a category and not adding them to a category, etc.

The images (JPGs) ARE going into the directory where the ads have been loading into using the old version (/sites/default/files) and they have the same CHMOD value (644) as the other (old) ads that are still successfully displaying on the web site.

I cannot see anything reading through the docs that I am supposed to change.

#1

assminog - April 28, 2009 - 07:03

Same problem:No images have been uploaded. Please upload an image via the File attachments form section below. Image is uploaded.
ad_flash missing flash file too.

#2

Kevin.K - April 28, 2009 - 18:30

A "created" ad is placed in the "files" MySQL table, but the matching fid record is NOT placed in the "ad_image" table, thus the error message that the image cannot be found.

The new ad content is not successfully created.

I guess I will have to uninstall this and just either go with the old version or make my ads manually for the time being w/ no randomness.

#3

Jeremy - May 7, 2009 - 14:46
Status:active» postponed (maintainer needs more info)

What contrib modules do you have enabled? What OS are you using? This used to be a common bug in 5.x, but I've not seen it in 6.x.

#4

Kevin.K - May 10, 2009 - 13:55

Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_bwlimited/1.4 PHP/5.2.9

Modules in use are:
CCK
GCal Events
Advanced Help
Secure Pages
Slideshow Creator
Teaser By Content Type
CAPTCHA (w/ Text CAPTCHA enabled)
jQuery plugins
Views

The Ad module was removed (uninstalled) since it was not working and I had a couple issues where all of a sudden it could not find any of the (already uploaded) ads to display. Since I did not want that happening on the production site, I removed it.

I can try and recreate the problem on my WampServer and see if I can isolate anything by disabling other modules, if that will help you?

#5

Tezla - May 14, 2009 - 07:16

Same here.

I noticed this behavior...

When I first setup an Ad ... the Image Section (where you set the destination URL and MouseOver) is missing from the screen. So, I just set everything else and image file seems to upload ok. Then I click Save at the bottom, at the top of the screen, it says in green "Unable to Locate Image". (If I take a peak with my FTP program the image file is there). But if I scroll down, the Image section is finally there. So, I put in the URL (the file info is still filled in) and click save then it comes back at the top in red this time "It is required to Upload an image ...". The file section is blank now. So, I browse and upload it again, it renames it a bit (to prevent dups I guess) and then it finally works.

Fresh install of Drupal 6.11.
Modules:
Captcha
FiveStar
VotingAPI
FCKEditor (no uploads configured)
FAQ
UberCart 6.x-2.0-rc2
AND all Required and Suggested optional modules for UberCart (the list is on their install page ... but I can get them if you need them)

I turned on Upload Module and installed this 6.x-2.0 version toward the end. I already had UberCart working before. It uploads Product images with other modules.

One other thing I noticed ... after initial install there was no actual "default" Ad group setup. But, in Ad Reports and in layout Blocks ... it references one. Not sure where that is coming from because the only Ad Groups setup are the ones I setup myself.

Thanks for this module. It looks very nice.

#6

Jeremy - May 15, 2009 - 13:29

Do you have an ad blocker installed in your browser? If you disable it, does the problem go away?

#7

Kevin.K - May 27, 2009 - 18:52

As posted by Tezla, multiple "Image Attachment" actions will make the image available for use. The first time through, the image cannot be found. I then do another upload, and the image is found successfully.

Through trial and error, I have developed a system to add an advert that results in one image being uploaded.

Go to add an ad.
Fill in the title, define as image type, and select NOT to post to front page.
Click save - prompt states that I need to upload an image.
Upload the image and click save.
The image will be uploaded and visible.
Then I edit and set the ad group, link, alternate text, and make it active.

#8

SocialNicheGuru - July 25, 2009 - 21:56

happening to me too.

#9

wexy - July 27, 2009 - 13:58

Getting same error, I upload the image several times but still getting error that I haven't uploaded it..

#10

SocialNicheGuru - July 27, 2009 - 21:39

i have to check the list box before it will actually upload

#11

wexy - July 28, 2009 - 15:31

Thanks! Checking the [x] list option next to the attached file makes things work.

#12

Jeremy - July 29, 2009 - 22:07

I've updated the README to document that "List" needs to be checked. However, this does not appear to be the problem with the original poster of this issue.

Does this solve the problem for everyone on this issue, or are there people for which checking "List" does not help?

#13

Kethaera - July 30, 2009 - 01:18

I am one that has this issue even with "List" checked.

#14

Jeremy - August 4, 2009 - 21:40

Does the upload module work in general? Are the images successfully being uploaded? Did this ever work for you? What OS are you using? Have you tried multiple browsers? What else may be unusual about your installation?

#15

SocialNicheGuru - August 4, 2009 - 23:05

the module does work.

the list checkbox does need to be checked.

In garland it is checked automatically. If there is a setting in upload that I might have overlooked, please let me know.

#16

Kethaera - August 5, 2009 - 00:24

Does the upload module work in general?
Yes

Are the images successfully being uploaded?
Yes, the images are being successfully uploaded, I have to end up uploading them multiple time to the same ad, and I can see every one attached, but still the error.

Did this ever work for you?
Yes, eventually after several uploads, one will finally take. It does not seem to be consistent how many it takes. I upload a couple, then start deleting old ones at the same time as I try a new attempt.

What OS are you using?
Linux/MySQL, PHP 5.x

Have you tried multiple browsers?
Yes, IE8 and FF3.5

What else may be unusual about your installation?
I do have PathAuto and PathRedirect. Since they seem to be causing issues with Ad Channels, perhaps that is also the case here.

#17

Jeremy - August 5, 2009 - 01:22
Status:postponed (maintainer needs more info)» active

Interesting. It's a common enough issue that other people are running into it too, and yet it seems to only be affecting a subset of Ad module users. I've still been unable to duplicate it. I'll try and test with PathAuto and PathRedirect soon to see if there is a conflict -- I'd love to track this down.

Can anyone else confirm that they're also still having this problem? Do you see anything in common with what Kethaera is reporting?

#18

Jeremy - August 5, 2009 - 01:33

When you say PathRedirect, do you mean GlobalRedirect?

#19

Jeremy - August 5, 2009 - 01:39
Status:active» postponed (maintainer needs more info)

I enabled the PathAuto and GlobalRedirect modules but am still able create image ads without any problems.

What happens if you try creating image ads with user ID 1? Do you have the ad_owners module enabled? Does it help to disable this module?

#20

Kevin.K - August 6, 2009 - 03:47

I originated this problem. Since I posted my workaround, I guess I gave it no thought since then - as it was working for me. If you are working on it again, I would be happy to test for you since I started the issue. If not, no worries. Just thought I would offer.

After reading the comments above, I went and tried to create another ad, using user #1 (which is the user I always use). I filled out the title, selected Image Ad, and uploaded a file. The list box was checked already (and always has been, as far as I know). I use the Newswire theme.

The error I received is the same as the error in the description of this issue, so it is not in the SQL database, however the image IS in the files directory, same as before.

If you want further testing by me, I will be happy to oblige. Creating the ad using my workaround works every time, the image is just uploaded on the second pass through, after I get the message that I must upload an image file.

Module checkboxes are: Ad, Ad click filter, Ad report, Ad weight probability, Image ad.

Kevin

#21

Kethaera - August 5, 2009 - 19:15

Jeremy, it's actually Path Redirect http://drupal.org/project/path_redirect .

I have been using user ID 1, but I enabled a new account with ad permissions and tested, and it also has the image upload error. I did have Ad Owner enabled, but I disabled it, along with Ad File Cache. Still having the error. So I disabled Ad Channel. Still having the error. I removed all punctuation from my image name (I'm bad at abusing -'s and _'s). No go. I unchecked the URL alias option, so that no alias should be generated. Still getting the error.

My next step planned is to disable PathAuto and PathRedirect, but as I'm actually testing on a production site with a lot of user-generated content, I'm going to have to wait a low traffic time (probably at night US time) and put the site into maintenance mode while I do. Let me know if there's any other tests you'd like me to run while I do.

Oh, I'm using a custom Zen sub-theme. The ad modules I have enabled now are:
Ad
Ad Channel
Ad Embed
Ad Report
Ad Weight Probability
Image Ad
Text Ad

Would you like a list of all the modules we have enabled? It's a long one, my client has feature creep!

#22

mike-green - September 16, 2009 - 10:59

We've had similar problem here.
It went away after removing ad groups. Strange bug.

#23

djudd - October 17, 2009 - 16:11

I was having this problem this morning while uploading 39 new ads to my site. Then I noticed that if I set the ad type to Image, but didn't hit select, I got that error.

If I set the type to Image, and hit the select button, no error. That's on me, I'm pretty sure that Select button is there for a reason.

#24

blackice78 - November 17, 2009 - 18:01

I had the same problem, also clicking on preview button not only on submit.
Don't know why, but I notice that at line 523 of ad_image.module sometimes in
foreach ($files as $file)
$file is not an object but an array so next if statement
if ($file->list && file_exists($file->filepath))
is always FALSE an code return the "Unable to locate image" error.
Just adding a type cast between the two lines
$file=(object)$file;
worked for me.
Hope It Helps.

#25

Matt G - November 22, 2009 - 22:22

That's the fix!

I just installed the ad module today on a new site I'm developing.

I also had the "unable to locate image" error.

But the fix blackice78 described worked for me too.

I edited sites\all\modules\ad\image\ad_image.module

scroll down to line 523 and you'll see:

foreach ($files as $file) {
      if ($file->list && file_exists($file->filepath)) {

And I inserted $file=(object)$file; between those two lines:

foreach ($files as $file) {

  // fix for "unable to locate image" bug
  $file=(object)$file;

      if ($file->list && file_exists($file->filepath)) {

Thank you blackice78.

#26

Jeremy - November 23, 2009 - 06:46
Status:postponed (maintainer needs more info)» fixed

Nice catch! Fix committed:
http://drupal.org/cvs?commit=292812

#27

EastwoodArts - November 30, 2009 - 18:35

Still an issue here. Running Drupal 6.14 and the latest module version 2.2 (2009-Nov-30). Tried all the suggestions in the thread.

 
 

Drupal is a registered trademark of Dries Buytaert.