Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Not loading the .png images

New Here ,
Aug 26, 2013 Aug 26, 2013

I am loading the images from RSS feed, it works perfectly with .jpg images, but not .png or any other formates. here is my code:

function getImgUrl(str:String):String {

    var pattern:RegExp = /src=\"([^\"]+\.jpg|gif|tiff|jpeg|png)/ig;

can some one help Me please.

thanks,

Naveen

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Aug 26, 2013 Aug 26, 2013

Expression is missing brackets - it needs to group alterations. It should be:

/src=\"([^\"]+\.(jpg|gif|tiff|jpeg|png))/ig;

Translate
Guru ,
Aug 26, 2013 Aug 26, 2013

first test if it works if you exchange the positions of your jpg/png file formats inside your regular Expression.

if yes: then sth in the syntax of your pattern is faulty

if no: somehow your application can only work with jpg images (look how to use PNGEncoder in a as3)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2013 Aug 26, 2013

Hi Moccamaximum,

I exchanged the position of jpg/png  and it works only for png images, here is the code:

var pattern:RegExp = /src=\"([^\"]+\.png|gif|tiff|jpeg|png)/ig;

I think im missing somthing on my syntax for identifing all the formates of images (jpg/png/tiff/gif/jpeg).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 26, 2013 Aug 26, 2013

I´m really no expert in regExp, sorry, hopefully some on this forum that are, will read your post 😉

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2013 Aug 26, 2013

thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 26, 2013 Aug 26, 2013

Expression is missing brackets - it needs to group alterations. It should be:

/src=\"([^\"]+\.(jpg|gif|tiff|jpeg|png))/ig;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2013 Aug 26, 2013

working perfectly    thank you very much Andrei

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 26, 2013 Aug 26, 2013
LATEST

You're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines