dongweihuai5601 2011-06-02 00:55
浏览 69
已采纳

如何约束youtube嵌入iframe大小的大小?

The youtube embed code's general structure is like this:

<iframe width="560" height="349" src="http://www.youtube.com/embed/MiYND_zvIc0" frameborder="0" allowfullscreen></iframe>

I want users to upload this code to my SQL table and then I will retrieve and output all the embed codes from the SQL table. The problem is that I have no choice as to what width or height the iframe is going to be since the users are making the embed codes through youtube's site.

Let's say I have 20 instances of the code I posted above and I want to auto-resize all the iframes to 640 x 480 when they get retrieved. How do I do this?

  • 写回答

1条回答 默认 最新

  • douli6605 2011-06-02 01:06
    关注

    first, use substr function with strpos to grab and save 3 things in you database:

    • youtube id
    • width
    • height

    second, use substr_replace function to change the value of all instances depending on your needs

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题